3892: Workspace Enhancement: use a cache to the list of users during Workspace init
Task-Url: https://support.d4science.org/issues/3892 Updated pom version at 6.11.2 Moved UserStore to get all contacts from DialogShare to ApplicationController in order to load list of users in init phase git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@128471 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
6baae05b1c
commit
4fa170fa62
12
pom.xml
12
pom.xml
|
@ -10,7 +10,7 @@
|
|||
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>workspace-tree-widget</artifactId>
|
||||
<version>6.11.1-SNAPSHOT</version>
|
||||
<version>6.11.2-SNAPSHOT</version>
|
||||
<name>gCube Workspace Tree Widget</name>
|
||||
<description>
|
||||
gCube Workspace Tree Widget is a widget to navigate and interact with gCube Workspace
|
||||
|
@ -37,7 +37,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>maven-portal-bom</artifactId>
|
||||
<version>LATEST</version>
|
||||
<version>2.6.0-SNAPSHOT</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
@ -196,13 +196,6 @@
|
|||
<artifactId>xstream</artifactId>
|
||||
<version>1.4.5</version>
|
||||
</dependency>
|
||||
<!-- FILE UPLOAD-progress-bar -->
|
||||
<!-- <dependency> -->
|
||||
<!-- <groupId>org.gcube.portlets.widgets</groupId> -->
|
||||
<!-- <artifactId>fileupload-progress-bar</artifactId> -->
|
||||
<!-- <version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version> -->
|
||||
<!-- </dependency> -->
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
|
@ -242,7 +235,6 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.portal</groupId>
|
||||
<artifactId>social-networking-library</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -106,6 +106,7 @@ import org.gcube.portlets.user.workspace.client.util.RequestBuilderWorkspaceVali
|
|||
import org.gcube.portlets.user.workspace.client.util.WindowOpenParameter;
|
||||
import org.gcube.portlets.user.workspace.client.view.ExplorerPanel;
|
||||
import org.gcube.portlets.user.workspace.client.view.sharing.DialogShareFolder;
|
||||
import org.gcube.portlets.user.workspace.client.view.sharing.UserStore;
|
||||
import org.gcube.portlets.user.workspace.client.view.sharing.permissions.DialogPermission;
|
||||
import org.gcube.portlets.user.workspace.client.view.tree.AsyncTreePanel;
|
||||
import org.gcube.portlets.user.workspace.client.view.windows.BulkCreatorWindow;
|
||||
|
@ -175,6 +176,8 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
// private FileUploader fileUploader;
|
||||
public static String myLogin;
|
||||
public static String myLoginFirstName;
|
||||
//PRE-LOAD LIST OF USER FORM LIFERAY
|
||||
private UserStore userStore = new UserStore();
|
||||
|
||||
private static AppControllerExplorer singleton;
|
||||
|
||||
|
@ -440,7 +443,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
if(isNewFolder)
|
||||
dialogSharedFolder = new DialogShareFolder(parentDirectoryName,eventBus);
|
||||
else
|
||||
dialogSharedFolder = new DialogShareFolder(parentDirectoryName, sourceFileModel, eventBus);
|
||||
dialogSharedFolder = new DialogShareFolder(parentDirectoryName, sourceFileModel, eventBus, userStore);
|
||||
|
||||
|
||||
final DialogShareFolder finalDialog = dialogSharedFolder;
|
||||
|
@ -1904,6 +1907,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
* @return ExplorerPanel
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public ExplorerPanel getTreePanel(){
|
||||
|
||||
this.explorerPanel = getPanel();
|
||||
|
|
|
@ -47,8 +47,8 @@ public class DialogShareFolder extends Dialog {
|
|||
private TextField<String> txtName;
|
||||
private TextArea textAreaDescription = new TextArea();
|
||||
private FileModel parentFolder = null;
|
||||
private UserStore userStore = new UserStore();
|
||||
private MultiValuePanel suggestPanel = new MultiValuePanel(userStore);
|
||||
private UserStore userStore;
|
||||
private MultiValuePanel suggestPanel;
|
||||
private Button buttonMultiDrag = new Button("Choose Contacts");
|
||||
private TextField<String> txtOwner;
|
||||
private PanelTogglePermission permission;
|
||||
|
@ -63,7 +63,9 @@ public class DialogShareFolder extends Dialog {
|
|||
* @param folder the folder
|
||||
* @param eventBus the event bus
|
||||
*/
|
||||
public DialogShareFolder(String folderParentName, final FileModel folder, HandlerManager eventBus) {
|
||||
public DialogShareFolder(String folderParentName, final FileModel folder, HandlerManager eventBus, UserStore userStore) {
|
||||
this.userStore = userStore;
|
||||
this.suggestPanel = new MultiValuePanel(userStore);
|
||||
initLayout(folderParentName);
|
||||
this.parentFolder = folder;
|
||||
this.setIcon(Resources.getIconShareFolder());
|
||||
|
|
|
@ -12,8 +12,9 @@ import com.google.gwt.core.client.GWT;
|
|||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
/**
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* The Class UserStore.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
*/
|
||||
public class UserStore implements ContactFetcher{
|
||||
|
||||
|
@ -21,9 +22,16 @@ public class UserStore implements ContactFetcher{
|
|||
|
||||
// public boolean syncronizeCleanSharedUser = false;
|
||||
|
||||
/**
|
||||
* Instantiates a new user store.
|
||||
*/
|
||||
public UserStore() {
|
||||
loadAllUsersFromServer(null);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.user.workspace.client.view.sharing.ContactFetcher#getListContact(com.google.gwt.user.client.rpc.AsyncCallback, boolean)
|
||||
*/
|
||||
@Override
|
||||
public void getListContact(AsyncCallback<List<InfoContactModel>> callback, boolean reloadList){
|
||||
|
||||
|
@ -33,11 +41,19 @@ public class UserStore implements ContactFetcher{
|
|||
callback.onSuccess(listAllContact);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.user.workspace.client.view.sharing.ContactFetcher#getListSharedUserByFolderId(java.lang.String, com.google.gwt.user.client.rpc.AsyncCallback)
|
||||
*/
|
||||
@Override
|
||||
public void getListSharedUserByFolderId(String sharedFolderId, AsyncCallback<List<InfoContactModel>> callback){
|
||||
loadSharedUserBySharedFolderId(sharedFolderId, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all users from server.
|
||||
*
|
||||
* @param callback the callback
|
||||
*/
|
||||
private void loadAllUsersFromServer(final AsyncCallback<List<InfoContactModel>> callback){
|
||||
|
||||
listAllContact = new ArrayList<InfoContactModel>();
|
||||
|
@ -48,17 +64,25 @@ public class UserStore implements ContactFetcher{
|
|||
public void onSuccess(List<InfoContactModel> result) {
|
||||
GWT.log("loaded "+result.size() + " contacts from server");
|
||||
listAllContact = result;
|
||||
if(callback!=null)
|
||||
callback.onSuccess(listAllContact);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR +" retrieving user " + ConstantsExplorer.TRY_AGAIN, null);
|
||||
if(callback!=null)
|
||||
callback.onFailure(caught);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Load shared user by shared folder id.
|
||||
*
|
||||
* @param sharedFolderId the shared folder id
|
||||
* @param callback the callback
|
||||
*/
|
||||
private void loadSharedUserBySharedFolderId(final String sharedFolderId, final AsyncCallback<List<InfoContactModel>> callback){
|
||||
|
||||
// comboSharedUsers.mask("Loading users");
|
||||
|
@ -68,17 +92,22 @@ public class UserStore implements ContactFetcher{
|
|||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR +" retrieving user. " + ConstantsExplorer.TRY_AGAIN, null);
|
||||
if(callback!=null)
|
||||
callback.onFailure(caught);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<InfoContactModel> result) {
|
||||
GWT.log("loaded "+result.size() + " contacts from server for "+sharedFolderId);
|
||||
if(callback!=null)
|
||||
callback.onSuccess(result);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.user.workspace.client.view.sharing.ContactFetcher#getExclusiveContactsFromAllContact(java.util.List)
|
||||
*/
|
||||
@Override
|
||||
public List<InfoContactModel> getExclusiveContactsFromAllContact(List<InfoContactModel> listSharedUser){
|
||||
|
||||
|
@ -92,6 +121,9 @@ public class UserStore implements ContactFetcher{
|
|||
return listExclusiveContact;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.user.workspace.client.view.sharing.ContactFetcher#getOwner(java.lang.String, com.google.gwt.user.client.rpc.AsyncCallback)
|
||||
*/
|
||||
@Override
|
||||
public void getOwner(final String sharedFolderId,final AsyncCallback<InfoContactModel> callback) {
|
||||
|
||||
|
@ -105,8 +137,8 @@ public class UserStore implements ContactFetcher{
|
|||
|
||||
@Override
|
||||
public void onSuccess(InfoContactModel result) {
|
||||
if(callback!=null)
|
||||
callback.onSuccess(result);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1463,7 +1463,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
|
||||
try {
|
||||
|
||||
workspaceLogger.trace("Get all contacts from server...");
|
||||
workspaceLogger.debug("Get all contacts from server...");
|
||||
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
|
||||
|
||||
org.gcube.common.homelibrary.home.workspace.usermanager.UserManager hlUserManager = HomeLibrary.getHomeManagerFactory().getUserManager();
|
||||
|
@ -1504,6 +1504,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
workspaceLogger.trace("Home Library User Manager getting list Gcube Group");
|
||||
listContactsModel.addAll(builder.buildGXTListContactsModelFromGcubeGroup(hlUserManager.getGroups()));
|
||||
|
||||
workspaceLogger.debug("Returning list of contacts!");
|
||||
return listContactsModel;
|
||||
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -394,7 +394,7 @@ public class NotificationsProducer {
|
|||
if(userUnShared.getLogin().compareTo(userId)!=0){
|
||||
|
||||
logger.debug("Sending notification to user "+userUnShared.getLogin() +" unshared from folder "+shareFolder.getName());
|
||||
boolean notify = notificationsMng.notifyFolderRemovedUser(userUnShared.getLogin(), (WorkspaceSharedFolder) shareFolder);
|
||||
boolean notify = notificationsMng.notifyFolderRemovedUser(userUnShared.getLogin(), shareFolder);
|
||||
|
||||
if(!notify)
|
||||
logger.error("An error occured when notifies user: "+userUnShared.getLogin());
|
||||
|
@ -437,10 +437,7 @@ public class NotificationsProducer {
|
|||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||
|
||||
logger.trace("Sending notification to user "+infoContactModel.getLogin() +" added item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
||||
|
||||
//DEBUG
|
||||
System.out.println("Sending notification to user "+infoContactModel.getLogin() +" added item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
||||
logger.info("Sending notification to user "+infoContactModel.getLogin() +" added item [id: "+workspaceItem.getId() +"] name: "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
||||
|
||||
//DEBUG
|
||||
// System.out.println("Send notify folder un share user "+infoContactModel.getLogin());
|
||||
|
|
|
@ -31,9 +31,9 @@ public class ItemRetrieve {
|
|||
|
||||
// public static String DEFAULT_SCOPE = "/d4science.research-infrastructures.eu/gCubeApps"; //PRODUCTION
|
||||
public static String DEFAULT_SCOPE = "/gcube/devsec"; //DEV
|
||||
public static String TEST_USER = "gianpaolo.coro";
|
||||
public static String TEST_USER = "francesco.mangiacrapa";
|
||||
// public static String ITEMID = "63832213-098d-42d1-8774-89b6349764c0"; //Activity T3.4 working drafts/T2-EC-IMAR-HO-14-015 iMarine Sustainability WP - Business Model tools.pdf
|
||||
public static String ITEMID = "a5aca54d-67cf-4838-9025-9ef5bb204ae9";
|
||||
public static String ITEMID = "ce4866ee-8079-4acf-bcd6-1c9dd786eb73";
|
||||
// d81d3a64-603f-4907-ae74-be8353211807
|
||||
protected static Logger logger = Logger.getLogger(ItemRetrieve.class);
|
||||
|
||||
|
@ -48,14 +48,14 @@ public class ItemRetrieve {
|
|||
Workspace ws = getWorkspace();
|
||||
|
||||
System.out.println(ws.getRoot().getId());
|
||||
// retrieveFirstLevel(ws, null);
|
||||
|
||||
retrieveFirstLevel(ws, ITEMID);
|
||||
|
||||
System.out.println("get workspace -> OK");
|
||||
// WorkspaceItem item = ws.getItem(ITEMID);
|
||||
// System.out.println("get item id: "+item.getId()+", name: "+item.getName() +", parent: "+item.getParent());
|
||||
// System.out.println(item);
|
||||
retrieveFirstLevel(ws, null);
|
||||
//
|
||||
// retrieveFirstLevel(ws, ITEMID);
|
||||
//
|
||||
// System.out.println("get workspace -> OK");
|
||||
WorkspaceItem item = ws.getItem(ITEMID);
|
||||
System.out.println("get item id: "+item.getId()+", name: "+item.getName() +", parent: "+item.getParent().getId() +", parent name: "+item.getParent().getName()+", path :"+item.getPath());
|
||||
System.out.println(item);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -119,6 +119,7 @@ public class ItemRetrieve {
|
|||
int folderItemCounter = 0;
|
||||
int othersCounter = 0;
|
||||
for (WorkspaceItem workspaceItem : children) {
|
||||
try{
|
||||
|
||||
/*if(foundFolder!=null && !foundFolder.isEmpty()){
|
||||
if(workspaceItem.getId().compareTo(foundFolder)==0){
|
||||
|
@ -127,14 +128,14 @@ public class ItemRetrieve {
|
|||
}
|
||||
}*/
|
||||
|
||||
|
||||
switch (workspaceItem.getType()) {
|
||||
|
||||
case FOLDER:
|
||||
|
||||
WorkspaceFolder folder = (WorkspaceFolder) workspaceItem;
|
||||
|
||||
System.out.println(++i+") "+folder.getId() +" folder name: "+folder.getName() + " owner "+folder.getOwner() +" path: "+folder.getPath());
|
||||
// System.out.println(++i+") "+folder.getId() +" folder name: "+folder.getName() + " owner "+folder.getOwner() +" path: "+folder.getPath());
|
||||
System.out.println(++i+") "+folder.getId() +" folder name: "+folder.getName() + " owner "+folder.getOwner());
|
||||
foldersCounter++;
|
||||
|
||||
break;
|
||||
|
@ -143,7 +144,8 @@ public class ItemRetrieve {
|
|||
|
||||
WorkspaceSharedFolder shared = (WorkspaceSharedFolder) workspaceItem;
|
||||
|
||||
System.out.println(++i+") "+shared.getId() +" shared folder name: "+shared.getName() + " owner "+shared.getOwner()+" isVRE "+shared.isVreFolder() +" ACLOwner: "+shared.getACLOwner()+" AclUser: "+shared.getACLUser() +" path: "+shared.getPath());
|
||||
// System.out.println(++i+") "+shared.getId() +" shared folder name: "+shared.getName() + " owner "+shared.getOwner()+" isVRE "+shared.isVreFolder() +" ACLOwner: "+shared.getACLOwner()+" AclUser: "+shared.getACLUser() +" path: "+shared.getPath());
|
||||
System.out.println(++i+") "+shared.getId() +" shared folder name: "+shared.getName());
|
||||
|
||||
// System.out.println(++i+") shared folder name: "+shared.getName() + " owner "+shared.getOwner().getPortalLogin());
|
||||
sharedFoldersCounter++;
|
||||
|
@ -154,7 +156,8 @@ public class ItemRetrieve {
|
|||
|
||||
FolderItem folderItem = (FolderItem) workspaceItem;
|
||||
|
||||
System.out.println(++i+") folderItem id: "+folderItem.getId() +", name: "+folderItem.getName() + ", own: "+folderItem.getOwner() +" path: "+folderItem.getPath());
|
||||
// System.out.println(++i+") folderItem id: "+folderItem.getId() +", name: "+folderItem.getName() + ", own: "+folderItem.getOwner() +" path: "+folderItem.getPath());
|
||||
System.out.println(++i+") folderItem id: "+folderItem.getId() +", name: "+folderItem.getName() + ", own: "+folderItem.getOwner());
|
||||
folderItemCounter++;
|
||||
|
||||
break;
|
||||
|
@ -163,6 +166,10 @@ public class ItemRetrieve {
|
|||
// othersCounter++;
|
||||
break;
|
||||
}
|
||||
}catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//TEST TIME
|
||||
|
|
Loading…
Reference in New Issue