Updated pom version at 6.13.1

Fixed incident: https://support.d4science.org/issues/4878

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@131030 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-08-29 13:39:13 +00:00
parent db62aaa5cc
commit f29b443fd5
8 changed files with 684 additions and 287 deletions

View File

@ -184,7 +184,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
// private FileUploader fileUploader; // private FileUploader fileUploader;
public static String myLogin; public static String myLogin;
public static String myLoginFirstName; public static String myLoginFirstName;
public static boolean ckanEditorOrAdmin; public static Boolean ckanEditorOrAdmin;
//PRE-LOAD LIST OF USER FORM LIFERAY //PRE-LOAD LIST OF USER FORM LIFERAY
private UserStore userStore = new UserStore(); private UserStore userStore = new UserStore();
@ -257,10 +257,10 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
modal.add(new CreateDatasetForm(folderId, username, eventBus)); modal.add(new CreateDatasetForm(folderId, username, eventBus));
modal.setCloseVisible(true); modal.setCloseVisible(true);
modal.show(); modal.show();
// hide any popup panel opened // hide any popup panel opened
modal.addHideHandler(new HideHandler() { modal.addHideHandler(new HideHandler() {
@Override @Override
public void onHide(HideEvent hideEvent) { public void onHide(HideEvent hideEvent) {
eventBus.fireEvent(new CloseCreationFormEvent()); eventBus.fireEvent(new CloseCreationFormEvent());
@ -2013,6 +2013,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
public ExplorerPanel getPanel(){ public ExplorerPanel getPanel(){
this.explorerPanel = new ExplorerPanel(true, true); this.explorerPanel = new ExplorerPanel(true, true);
loadMyLogin(); loadMyLogin();
loadMyFirstName();
return this.explorerPanel; return this.explorerPanel;
} }
@ -2030,6 +2031,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
this.explorerPanel = new ExplorerPanel(instancingSmartFolder, instancingMessages, selectRootItem); this.explorerPanel = new ExplorerPanel(instancingSmartFolder, instancingMessages, selectRootItem);
this.selectRootItem=selectRootItem; this.selectRootItem=selectRootItem;
loadMyLogin(); loadMyLogin();
loadMyFirstName();
return this.explorerPanel; return this.explorerPanel;
} }
@ -2281,12 +2283,13 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
GWT.log("Error on loading my login is empty"); GWT.log("Error on loading my login is empty");
ConstantsExplorer.log("Error on loading my login is empty");
myLogin = ""; myLogin = "";
} }
@Override @Override
public void onSuccess(UserBean user) { public void onSuccess(UserBean user) {
ConstantsExplorer.log("UserBean is: "+user.toString());
GWT.log("My login is: "+user.getUsername()); GWT.log("My login is: "+user.getUsername());
myLogin = user.getUsername(); myLogin = user.getUsername();
myLoginFirstName = user.getFirstName(); myLoginFirstName = user.getFirstName();
@ -2296,6 +2299,28 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
} }
/**
* Load my first name.
*/
private void loadMyFirstName(){
rpcWorkspaceService.getMyFirstName(new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
ConstantsExplorer.log("Error on loading my first name");
myLoginFirstName = "";
}
@Override
public void onSuccess(String firstName) {
ConstantsExplorer.log("getMyFirstName is: "+firstName);
myLoginFirstName = firstName;
}
});
}
/** /**
* Load item from workspace. * Load item from workspace.
* *

View File

@ -228,4 +228,9 @@ public class ConstantsExplorer {
public static final int HEIGHT_DIALOG_SHARE_FOLDER = 445; public static final int HEIGHT_DIALOG_SHARE_FOLDER = 445;
public static native void log(String txt) /*-{
console.log(txt)
}-*/;
} }

View File

@ -693,17 +693,22 @@ public interface GWTWorkspaceService extends RemoteService{
void setGcubeItemProperties(String itemId, Map<String, String> properties) throws Exception; void setGcubeItemProperties(String itemId, Map<String, String> properties) throws Exception;
FileModel getItemForFileTree(String itemId) throws Exception; FileModel getItemForFileTree(String itemId) throws Exception;
/** /**
* Allows the user to public onto the data catalogue if he has at least * Allows the user to public onto the data catalogue if he has at least
* the role admin somewhere. * the role admin somewhere.
* @return true if he can publish, false otherwise * @return true if he can publish, false otherwise
*/ */
boolean hasUserRoleAdmin(); boolean hasUserRoleAdmin();
/** /**
* Retrieve the username of the user into the session * Retrieve the username of the user into the session
* @return the username of the current user * @return the username of the current user
*/ */
String getUser(); String getUser();
/**
* @return
*/
String getMyFirstName();
} }

View File

@ -684,7 +684,7 @@ public interface GWTWorkspaceServiceAsync {
AsyncCallback<Void> callback); AsyncCallback<Void> callback);
/** /**
* Allows the user to public onto the data catalogue if he has at least * Allows the user to public onto the data catalogue if he has at least
* the role admin somewhere. * the role admin somewhere.
* @return true if he can publish, false otherwise * @return true if he can publish, false otherwise
*/ */
@ -696,4 +696,6 @@ public interface GWTWorkspaceServiceAsync {
*/ */
void getUser(AsyncCallback<String> callback); void getUser(AsyncCallback<String> callback);
void getMyFirstName(AsyncCallback<String> callback);
} }

View File

@ -542,6 +542,7 @@ public class GWTWorkspaceBuilder {
// startTime = System.currentTimeMillis(); // startTime = System.currentTimeMillis();
for (WorkspaceItem item : listItems){ for (WorkspaceItem item : listItems){
logger.debug("item: "+item.getName()+ "is root? " +item.isRoot());
listFileModel.add(buildGXTFileModelItem(item,parentFolderModel)); listFileModel.add(buildGXTFileModelItem(item,parentFolderModel));
} }

View File

@ -2672,7 +2672,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
try { try {
LiferayUserManager l = new LiferayUserManager(); LiferayUserManager l = new LiferayUserManager();
GCubeUser user = l.getUserByUsername(username); GCubeUser user = l.getUserByUsername(username);
workspaceLogger.info("My login first name is: "+user.getFirstName());
firstName = user.getFirstName(); firstName = user.getFirstName();
lastName = user.getLastName(); lastName = user.getLastName();
email = user.getEmail(); email = user.getEmail();
@ -2687,9 +2686,39 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
} }
} }
return new UserBean(username, firstName, lastName, email, publishRights);
UserBean us = new UserBean(username, firstName, lastName, email, publishRights);
workspaceLogger.info("Returning myLogin: "+us);
return us;
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.workspace.client.rpc.GWTWorkspaceService#getMyLogin()
*/
@Override
public String getMyFirstName(){
ASLSession asl = WsUtil.getAslSession(this.getThreadLocalRequest().getSession());
String username = asl.getUsername();
String firstName = "";
if (isWithinPortal() && username.compareTo(WsUtil.TEST_USER) != 0) {
try {
LiferayUserManager l = new LiferayUserManager();
GCubeUser user = l.getUserByUsername(username);
workspaceLogger.info("My login first name is: "+user.getFirstName());
firstName = user.getFirstName();
}catch (UserManagementSystemException e) {
workspaceLogger.error("UserManagementSystemException for username: "+username);
}
catch (UserRetrievalFault e) {
workspaceLogger.error("UserRetrievalFault for username: "+username);
}
}
return firstName;
}
/** /**
* Update acl for vr eby group name. * Update acl for vr eby group name.
* *

View File

@ -2,60 +2,145 @@ package org.gcube.portlets.user.workspace.shared;
import java.io.Serializable; import java.io.Serializable;
@SuppressWarnings("serial")
public class UserBean implements Serializable { public class UserBean implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6779963164440480883L;
private String username; private String username;
private String firstName; private String firstName;
private String lastName; private String lastName;
private String email; private String email;
private Boolean cataloguePermission; private Boolean cataloguePermission;
public UserBean(String username, String firstName, String lastName,
String email, Boolean cataloguePermission) {
super();
this.cataloguePermission = cataloguePermission;
this.username = username;
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
}
public UserBean() { public UserBean() {
} }
public String getUsername() {
return username; public UserBean(String username, String firstName, String lastName, String email, Boolean cataloguePermission) {
}
public void setUsername(String username) {
this.username = username; this.username = username;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName; this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName; this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email; this.email = email;
}
public Boolean hasCataloguePermission() {
return cataloguePermission;
}
public void setCataloguePermission(Boolean cataloguePermission) {
this.cataloguePermission = cataloguePermission; this.cataloguePermission = cataloguePermission;
} }
/**
* @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;
}
/**
* @return the cataloguePermission
*/
public Boolean getCataloguePermission() {
return cataloguePermission;
}
/**
* @param username the username to set
*/
public void setUsername(String username) {
this.username = username;
}
/**
* @param firstName the firstName to set
*/
public void setFirstName(String firstName) {
this.firstName = firstName;
}
/**
* @param lastName the lastName to set
*/
public void setLastName(String lastName) {
this.lastName = lastName;
}
/**
* @param email the email to set
*/
public void setEmail(String email) {
this.email = email;
}
/**
* @param cataloguePermission the cataloguePermission to set
*/
public void setCataloguePermission(Boolean cataloguePermission) {
this.cataloguePermission = cataloguePermission;
}
public Boolean hasCataloguePermission() {
return cataloguePermission;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override @Override
public String toString() { public String toString() {
return "UserBean [username=" + username + ", firstName=" + firstName
+ ", lastName=" + lastName + ", email=" + email StringBuilder builder = new StringBuilder();
+ ", cataloguePermission=" + cataloguePermission + "]"; builder.append("UserBean [username=");
builder.append(username);
builder.append(", firstName=");
builder.append(firstName);
builder.append(", lastName=");
builder.append(lastName);
builder.append(", email=");
builder.append(email);
builder.append(", cataloguePermission=");
builder.append(cataloguePermission);
builder.append("]");
return builder.toString();
} }
} }