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
22
pom.xml
22
pom.xml
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>workspace-tree-widget</artifactId>
|
<artifactId>workspace-tree-widget</artifactId>
|
||||||
<version>6.11.1-SNAPSHOT</version>
|
<version>6.11.2-SNAPSHOT</version>
|
||||||
<name>gCube Workspace Tree Widget</name>
|
<name>gCube Workspace Tree Widget</name>
|
||||||
<description>
|
<description>
|
||||||
gCube Workspace Tree Widget is a widget to navigate and interact with gCube Workspace
|
gCube Workspace Tree Widget is a widget to navigate and interact with gCube Workspace
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.distribution</groupId>
|
<groupId>org.gcube.distribution</groupId>
|
||||||
<artifactId>maven-portal-bom</artifactId>
|
<artifactId>maven-portal-bom</artifactId>
|
||||||
<version>LATEST</version>
|
<version>2.6.0-SNAPSHOT</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -47,11 +47,11 @@
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!-- UNCOMMENT THIS TO RUN IN DEVO MODE -->
|
<!-- UNCOMMENT THIS TO RUN IN DEVO MODE -->
|
||||||
<!-- <dependency> -->
|
<!-- <dependency> -->
|
||||||
<!-- <groupId>xerces</groupId> -->
|
<!-- <groupId>xerces</groupId> -->
|
||||||
<!-- <artifactId>xerces</artifactId> -->
|
<!-- <artifactId>xerces</artifactId> -->
|
||||||
<!-- <version>2.4.0</version> -->
|
<!-- <version>2.4.0</version> -->
|
||||||
<!-- </dependency> -->
|
<!-- </dependency> -->
|
||||||
|
|
||||||
<!-- This dependency is needed to use GWT UI BInder without old Xerces
|
<!-- This dependency is needed to use GWT UI BInder without old Xerces
|
||||||
version of gCore complaining -->
|
version of gCore complaining -->
|
||||||
|
@ -196,13 +196,6 @@
|
||||||
<artifactId>xstream</artifactId>
|
<artifactId>xstream</artifactId>
|
||||||
<version>1.4.5</version>
|
<version>1.4.5</version>
|
||||||
</dependency>
|
</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>
|
<dependency>
|
||||||
<groupId>org.gcube.portlets.widgets</groupId>
|
<groupId>org.gcube.portlets.widgets</groupId>
|
||||||
|
@ -242,7 +235,6 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portal</groupId>
|
<groupId>org.gcube.portal</groupId>
|
||||||
<artifactId>social-networking-library</artifactId>
|
<artifactId>social-networking-library</artifactId>
|
||||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<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.util.WindowOpenParameter;
|
||||||
import org.gcube.portlets.user.workspace.client.view.ExplorerPanel;
|
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.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.sharing.permissions.DialogPermission;
|
||||||
import org.gcube.portlets.user.workspace.client.view.tree.AsyncTreePanel;
|
import org.gcube.portlets.user.workspace.client.view.tree.AsyncTreePanel;
|
||||||
import org.gcube.portlets.user.workspace.client.view.windows.BulkCreatorWindow;
|
import org.gcube.portlets.user.workspace.client.view.windows.BulkCreatorWindow;
|
||||||
|
@ -175,6 +176,8 @@ 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;
|
||||||
|
//PRE-LOAD LIST OF USER FORM LIFERAY
|
||||||
|
private UserStore userStore = new UserStore();
|
||||||
|
|
||||||
private static AppControllerExplorer singleton;
|
private static AppControllerExplorer singleton;
|
||||||
|
|
||||||
|
@ -440,7 +443,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
if(isNewFolder)
|
if(isNewFolder)
|
||||||
dialogSharedFolder = new DialogShareFolder(parentDirectoryName,eventBus);
|
dialogSharedFolder = new DialogShareFolder(parentDirectoryName,eventBus);
|
||||||
else
|
else
|
||||||
dialogSharedFolder = new DialogShareFolder(parentDirectoryName, sourceFileModel, eventBus);
|
dialogSharedFolder = new DialogShareFolder(parentDirectoryName, sourceFileModel, eventBus, userStore);
|
||||||
|
|
||||||
|
|
||||||
final DialogShareFolder finalDialog = dialogSharedFolder;
|
final DialogShareFolder finalDialog = dialogSharedFolder;
|
||||||
|
@ -1904,6 +1907,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
* @return ExplorerPanel
|
* @return ExplorerPanel
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public ExplorerPanel getTreePanel(){
|
public ExplorerPanel getTreePanel(){
|
||||||
|
|
||||||
this.explorerPanel = getPanel();
|
this.explorerPanel = getPanel();
|
||||||
|
|
|
@ -41,14 +41,14 @@ import com.google.gwt.user.client.ui.Label;
|
||||||
* Nov 4, 2015
|
* Nov 4, 2015
|
||||||
*/
|
*/
|
||||||
public class DialogShareFolder extends Dialog {
|
public class DialogShareFolder extends Dialog {
|
||||||
|
|
||||||
private int widthDialog = 535;
|
private int widthDialog = 535;
|
||||||
private int heightTextArea = 100;
|
private int heightTextArea = 100;
|
||||||
private TextField<String> txtName;
|
private TextField<String> txtName;
|
||||||
private TextArea textAreaDescription = new TextArea();
|
private TextArea textAreaDescription = new TextArea();
|
||||||
private FileModel parentFolder = null;
|
private FileModel parentFolder = null;
|
||||||
private UserStore userStore = new UserStore();
|
private UserStore userStore;
|
||||||
private MultiValuePanel suggestPanel = new MultiValuePanel(userStore);
|
private MultiValuePanel suggestPanel;
|
||||||
private Button buttonMultiDrag = new Button("Choose Contacts");
|
private Button buttonMultiDrag = new Button("Choose Contacts");
|
||||||
private TextField<String> txtOwner;
|
private TextField<String> txtOwner;
|
||||||
private PanelTogglePermission permission;
|
private PanelTogglePermission permission;
|
||||||
|
@ -63,14 +63,16 @@ public class DialogShareFolder extends Dialog {
|
||||||
* @param folder the folder
|
* @param folder the folder
|
||||||
* @param eventBus the event bus
|
* @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);
|
initLayout(folderParentName);
|
||||||
this.parentFolder = folder;
|
this.parentFolder = folder;
|
||||||
this.setIcon(Resources.getIconShareFolder());
|
this.setIcon(Resources.getIconShareFolder());
|
||||||
|
|
||||||
setWidth(widthDialog);
|
setWidth(widthDialog);
|
||||||
setButtons(Dialog.OKCANCEL);
|
setButtons(Dialog.OKCANCEL);
|
||||||
|
|
||||||
setHeading("Share folder: "+folder.getName());
|
setHeading("Share folder: "+folder.getName());
|
||||||
|
|
||||||
txtName = new TextField<String>();
|
txtName = new TextField<String>();
|
||||||
|
@ -79,7 +81,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
txtName.setReadOnly(true);
|
txtName.setReadOnly(true);
|
||||||
txtName.setAutoValidate(true);
|
txtName.setAutoValidate(true);
|
||||||
txtName.setFieldLabel("Folder Name");
|
txtName.setFieldLabel("Folder Name");
|
||||||
|
|
||||||
txtOwner = new TextField<String>();
|
txtOwner = new TextField<String>();
|
||||||
txtOwner.setAllowBlank(true);
|
txtOwner.setAllowBlank(true);
|
||||||
txtOwner.setValue("");
|
txtOwner.setValue("");
|
||||||
|
@ -90,7 +92,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
textAreaDescription.setFieldLabel(ConstantsExplorer.DIALOG_DESCRIPTION);
|
textAreaDescription.setFieldLabel(ConstantsExplorer.DIALOG_DESCRIPTION);
|
||||||
textAreaDescription.setHeight(heightTextArea);
|
textAreaDescription.setHeight(heightTextArea);
|
||||||
textAreaDescription.setWidth(380);
|
textAreaDescription.setWidth(380);
|
||||||
|
|
||||||
textAreaDescription.setValue(folder.getDescription());
|
textAreaDescription.setValue(folder.getDescription());
|
||||||
// textAreaDescription.setReadOnly(true);
|
// textAreaDescription.setReadOnly(true);
|
||||||
|
|
||||||
|
@ -109,26 +111,26 @@ public class DialogShareFolder extends Dialog {
|
||||||
|
|
||||||
flexTable.setWidget(1, 0, new Label("Add more"));
|
flexTable.setWidget(1, 0, new Label("Add more"));
|
||||||
flexTable.setWidget(1, 1, buttonMultiDrag);
|
flexTable.setWidget(1, 1, buttonMultiDrag);
|
||||||
|
|
||||||
Label labelDescription = new Label("Description");
|
Label labelDescription = new Label("Description");
|
||||||
flexTable.setWidget(2, 0, labelDescription);
|
flexTable.setWidget(2, 0, labelDescription);
|
||||||
flexTable.setWidget(2, 1, textAreaDescription);
|
flexTable.setWidget(2, 1, textAreaDescription);
|
||||||
|
|
||||||
hpPermission = new HorizontalPanel();
|
hpPermission = new HorizontalPanel();
|
||||||
hpPermission.setVerticalAlign(VerticalAlignment.MIDDLE);
|
hpPermission.setVerticalAlign(VerticalAlignment.MIDDLE);
|
||||||
Label labelProperty = new Label("Permissions");
|
Label labelProperty = new Label("Permissions");
|
||||||
hpPermission.add(labelProperty);
|
hpPermission.add(labelProperty);
|
||||||
|
|
||||||
AppControllerExplorer.rpcWorkspaceService.getACLs(new AsyncCallback<List<WorkspaceACL>>() {
|
AppControllerExplorer.rpcWorkspaceService.getACLs(new AsyncCallback<List<WorkspaceACL>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<WorkspaceACL> result) {
|
public void onSuccess(List<WorkspaceACL> result) {
|
||||||
permission = new PanelTogglePermission(result);
|
permission = new PanelTogglePermission(result);
|
||||||
|
|
||||||
//ONLY IF FOLDER IS ALREADY SHARED, LOOADING CURRENT ACL FROM HL
|
//ONLY IF FOLDER IS ALREADY SHARED, LOOADING CURRENT ACL FROM HL
|
||||||
if(folder.isShared())
|
if(folder.isShared())
|
||||||
selectAclForFolder(folder);
|
selectAclForFolder(folder);
|
||||||
|
|
||||||
hpPermission.add(permission);
|
hpPermission.add(permission);
|
||||||
hpPermission.layout();
|
hpPermission.layout();
|
||||||
layout();
|
layout();
|
||||||
|
@ -141,12 +143,12 @@ public class DialogShareFolder extends Dialog {
|
||||||
layout();
|
layout();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
lc.add(flexTable);
|
lc.add(flexTable);
|
||||||
if(hpPermission!=null)
|
if(hpPermission!=null)
|
||||||
lc.add(hpPermission);
|
lc.add(hpPermission);
|
||||||
lc.mask();
|
lc.mask();
|
||||||
|
|
||||||
userStore.getOwner(folder.getIdentifier(), new AsyncCallback<InfoContactModel>() {
|
userStore.getOwner(folder.getIdentifier(), new AsyncCallback<InfoContactModel>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -170,10 +172,10 @@ public class DialogShareFolder extends Dialog {
|
||||||
add(lc);
|
add(lc);
|
||||||
addListners();
|
addListners();
|
||||||
enableFormDialog(false); //FORM IS DISABLED BY DEFAULT
|
enableFormDialog(false); //FORM IS DISABLED BY DEFAULT
|
||||||
|
|
||||||
this.show();
|
this.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update recipient of share.
|
* Update recipient of share.
|
||||||
*
|
*
|
||||||
|
@ -190,7 +192,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill recipient already shared.
|
* Fill recipient already shared.
|
||||||
|
@ -199,28 +201,28 @@ public class DialogShareFolder extends Dialog {
|
||||||
* @param lc the lc
|
* @param lc the lc
|
||||||
*/
|
*/
|
||||||
private void fillRecipientAlreadyShared(String folderId, final LayoutContainer lc) {
|
private void fillRecipientAlreadyShared(String folderId, final LayoutContainer lc) {
|
||||||
|
|
||||||
userStore.getListSharedUserByFolderId(folderId,
|
userStore.getListSharedUserByFolderId(folderId,
|
||||||
new AsyncCallback<List<InfoContactModel>>() {
|
new AsyncCallback<List<InfoContactModel>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<InfoContactModel> listContacts) {
|
public void onSuccess(List<InfoContactModel> listContacts) {
|
||||||
|
|
||||||
if (listContacts != null) {
|
if (listContacts != null) {
|
||||||
listAlreadyShared.addAll(listContacts);
|
listAlreadyShared.addAll(listContacts);
|
||||||
updateRecipientOfShare(listContacts);
|
updateRecipientOfShare(listContacts);
|
||||||
}
|
}
|
||||||
lc.unmask();
|
lc.unmask();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
lc.unmask();
|
lc.unmask();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Permission control.
|
* Permission control.
|
||||||
*
|
*
|
||||||
|
@ -229,7 +231,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
*/
|
*/
|
||||||
private void permissionControl(String owner, boolean showAlert){
|
private void permissionControl(String owner, boolean showAlert){
|
||||||
GWT.log("Permission control compare between owner: "+owner +" and my login: "+AppControllerExplorer.myLogin);
|
GWT.log("Permission control compare between owner: "+owner +" and my login: "+AppControllerExplorer.myLogin);
|
||||||
|
|
||||||
if(AppControllerExplorer.myLogin.compareToIgnoreCase(owner)!=0){
|
if(AppControllerExplorer.myLogin.compareToIgnoreCase(owner)!=0){
|
||||||
enableFormDialog(false);
|
enableFormDialog(false);
|
||||||
if(showAlert)
|
if(showAlert)
|
||||||
|
@ -238,7 +240,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
enableFormDialog(true);
|
enableFormDialog(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable form dialog.
|
* Enable form dialog.
|
||||||
*
|
*
|
||||||
|
@ -252,7 +254,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
permission.setEnabled(bool);
|
permission.setEnabled(bool);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the parent folder.
|
* Gets the parent folder.
|
||||||
*
|
*
|
||||||
|
@ -261,7 +263,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
public FileModel getParentFolder() {
|
public FileModel getParentFolder() {
|
||||||
return parentFolder;
|
return parentFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inits the layout.
|
* Inits the layout.
|
||||||
*
|
*
|
||||||
|
@ -278,7 +280,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
setWidth(widthDialog);
|
setWidth(widthDialog);
|
||||||
setHeight(400);
|
setHeight(400);
|
||||||
setResizable(true);
|
setResizable(true);
|
||||||
setButtonAlign(HorizontalAlignment.CENTER);
|
setButtonAlign(HorizontalAlignment.CENTER);
|
||||||
setWidth(widthDialog);
|
setWidth(widthDialog);
|
||||||
setButtons(Dialog.OKCANCEL);
|
setButtons(Dialog.OKCANCEL);
|
||||||
}
|
}
|
||||||
|
@ -290,7 +292,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
* @param eventBus the event bus
|
* @param eventBus the event bus
|
||||||
*/
|
*/
|
||||||
public DialogShareFolder(String folderParentName, HandlerManager eventBus) {
|
public DialogShareFolder(String folderParentName, HandlerManager eventBus) {
|
||||||
|
|
||||||
initLayout(folderParentName);
|
initLayout(folderParentName);
|
||||||
this.setIcon(Resources.getIconSharedFolder());
|
this.setIcon(Resources.getIconSharedFolder());
|
||||||
setHeading("Create a new shared folder in: "+folderParentName);
|
setHeading("Create a new shared folder in: "+folderParentName);
|
||||||
|
@ -308,7 +310,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
textAreaDescription.setFieldLabel(ConstantsExplorer.DIALOG_DESCRIPTION);
|
textAreaDescription.setFieldLabel(ConstantsExplorer.DIALOG_DESCRIPTION);
|
||||||
textAreaDescription.setHeight(heightTextArea);
|
textAreaDescription.setHeight(heightTextArea);
|
||||||
textAreaDescription.setWidth(380);
|
textAreaDescription.setWidth(380);
|
||||||
|
|
||||||
final LayoutContainer lc = new LayoutContainer();
|
final LayoutContainer lc = new LayoutContainer();
|
||||||
lc.setStyleAttribute("margin-top", "10px");
|
lc.setStyleAttribute("margin-top", "10px");
|
||||||
lc.setStyleAttribute("margin-bottom", "10px");
|
lc.setStyleAttribute("margin-bottom", "10px");
|
||||||
|
@ -324,14 +326,14 @@ public class DialogShareFolder extends Dialog {
|
||||||
|
|
||||||
flexTable.setWidget(1, 0, new Label("Add more"));
|
flexTable.setWidget(1, 0, new Label("Add more"));
|
||||||
flexTable.setWidget(1, 1, buttonMultiDrag);
|
flexTable.setWidget(1, 1, buttonMultiDrag);
|
||||||
|
|
||||||
Label labelDescription = new Label("Description");
|
Label labelDescription = new Label("Description");
|
||||||
flexTable.setWidget(2, 0, labelDescription);
|
flexTable.setWidget(2, 0, labelDescription);
|
||||||
flexTable.setWidget(2, 1, textAreaDescription);
|
flexTable.setWidget(2, 1, textAreaDescription);
|
||||||
|
|
||||||
hpPermission = new HorizontalPanel();
|
hpPermission = new HorizontalPanel();
|
||||||
hpPermission.setVerticalAlign(VerticalAlignment.MIDDLE);
|
hpPermission.setVerticalAlign(VerticalAlignment.MIDDLE);
|
||||||
Label labelProperty = new Label("Permissions");
|
Label labelProperty = new Label("Permissions");
|
||||||
hpPermission.add(labelProperty);
|
hpPermission.add(labelProperty);
|
||||||
|
|
||||||
AppControllerExplorer.rpcWorkspaceService.getACLs(new AsyncCallback<List<WorkspaceACL>>() {
|
AppControllerExplorer.rpcWorkspaceService.getACLs(new AsyncCallback<List<WorkspaceACL>>() {
|
||||||
|
@ -352,19 +354,19 @@ public class DialogShareFolder extends Dialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
lc.add(flexTable);
|
lc.add(flexTable);
|
||||||
lc.add(hpPermission);
|
lc.add(hpPermission);
|
||||||
|
|
||||||
setFocusWidget(txtName);
|
setFocusWidget(txtName);
|
||||||
add(txtName);
|
add(txtName);
|
||||||
add(lc);
|
add(lc);
|
||||||
|
|
||||||
addListners();
|
addListners();
|
||||||
|
|
||||||
this.show();
|
this.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the shared list users.
|
* Gets the shared list users.
|
||||||
*
|
*
|
||||||
|
@ -380,7 +382,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
* Adds the listners.
|
* Adds the listners.
|
||||||
*/
|
*/
|
||||||
public void addListners(){
|
public void addListners(){
|
||||||
|
|
||||||
this.getButtonById(Dialog.CANCEL).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
this.getButtonById(Dialog.CANCEL).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -388,8 +390,8 @@ public class DialogShareFolder extends Dialog {
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
this.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
this.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -397,28 +399,28 @@ public class DialogShareFolder extends Dialog {
|
||||||
if(isValidForm(false))
|
if(isValidForm(false))
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
buttonMultiDrag.addClickHandler(new ClickHandler() {
|
buttonMultiDrag.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
final MultiDragContact multiDrag = new MultiDragContact();
|
final MultiDragContact multiDrag = new MultiDragContact();
|
||||||
multiDrag.show();
|
multiDrag.show();
|
||||||
|
|
||||||
List<InfoContactModel> exclusiveContacts = userStore.getExclusiveContactsFromAllContact(suggestPanel.getSelectedUser());
|
List<InfoContactModel> exclusiveContacts = userStore.getExclusiveContactsFromAllContact(suggestPanel.getSelectedUser());
|
||||||
multiDrag.addSourceContacts(exclusiveContacts);
|
multiDrag.addSourceContacts(exclusiveContacts);
|
||||||
|
|
||||||
for (InfoContactModel infoContactModel : suggestPanel.getSelectedUser()) {
|
for (InfoContactModel infoContactModel : suggestPanel.getSelectedUser()) {
|
||||||
// if(!listAlreadyShared.contains(infoContactModel))
|
// if(!listAlreadyShared.contains(infoContactModel))
|
||||||
if(!isShareOwner(infoContactModel))
|
if(!isShareOwner(infoContactModel))
|
||||||
multiDrag.addTargetContact(infoContactModel);
|
multiDrag.addTargetContact(infoContactModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// multiDrag.addAlreadySharedContacts(suggestPanel.getSelectedUser());
|
// multiDrag.addAlreadySharedContacts(suggestPanel.getSelectedUser());
|
||||||
|
|
||||||
multiDrag.addAlreadySharedContacts(listAlreadyShared);
|
multiDrag.addAlreadySharedContacts(listAlreadyShared);
|
||||||
|
|
||||||
multiDrag.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
multiDrag.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -428,7 +430,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
suggestPanel.addRecipient(shareOwner.getName(),false);
|
suggestPanel.addRecipient(shareOwner.getName(),false);
|
||||||
for (InfoContactModel infoContactModel : multiDrag.getTargetListContact()) {
|
for (InfoContactModel infoContactModel : multiDrag.getTargetListContact()) {
|
||||||
suggestPanel.addRecipient(infoContactModel.getName(),true);
|
suggestPanel.addRecipient(infoContactModel.getName(),true);
|
||||||
}
|
}
|
||||||
suggestPanel.boxSetFocus();
|
suggestPanel.boxSetFocus();
|
||||||
// printSelectedUser();
|
// printSelectedUser();
|
||||||
}
|
}
|
||||||
|
@ -436,8 +438,8 @@ public class DialogShareFolder extends Dialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is share owner.
|
* Checks if is share owner.
|
||||||
*
|
*
|
||||||
|
@ -448,11 +450,11 @@ public class DialogShareFolder extends Dialog {
|
||||||
|
|
||||||
if(infoContactModel!=null && shareOwner!=null && InfoContactModel.COMPARATORLOGINS.compare(infoContactModel, shareOwner)==0)
|
if(infoContactModel!=null && shareOwner!=null && InfoContactModel.COMPARATORLOGINS.compare(infoContactModel, shareOwner)==0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List already shared contains.
|
* List already shared contains.
|
||||||
*
|
*
|
||||||
|
@ -460,10 +462,10 @@ public class DialogShareFolder extends Dialog {
|
||||||
* @return true, if successful
|
* @return true, if successful
|
||||||
*/
|
*/
|
||||||
private boolean listAlreadySharedContains(InfoContactModel contact){
|
private boolean listAlreadySharedContains(InfoContactModel contact){
|
||||||
|
|
||||||
if(contact==null)
|
if(contact==null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (InfoContactModel ct : listAlreadyShared) {
|
for (InfoContactModel ct : listAlreadyShared) {
|
||||||
if(InfoContactModel.COMPARATORLOGINS.compare(ct, contact)==0)
|
if(InfoContactModel.COMPARATORLOGINS.compare(ct, contact)==0)
|
||||||
// if(ct.getLogin().compareTo(contact.getLogin())==0)
|
// if(ct.getLogin().compareTo(contact.getLogin())==0)
|
||||||
|
@ -471,19 +473,19 @@ public class DialogShareFolder extends Dialog {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
/**
|
/**
|
||||||
* Prints the selected user.
|
* Prints the selected user.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private void printSelectedUser(){
|
private void printSelectedUser(){
|
||||||
|
|
||||||
System.out.println("SELETECTED USERS: ");
|
System.out.println("SELETECTED USERS: ");
|
||||||
for (InfoContactModel contact : suggestPanel.getSelectedUser())
|
for (InfoContactModel contact : suggestPanel.getSelectedUser())
|
||||||
System.out.println(contact);
|
System.out.println(contact);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inits the suggest contacts.
|
* Inits the suggest contacts.
|
||||||
*/
|
*/
|
||||||
|
@ -511,7 +513,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
if(textAreaDescription.getValue()==null)
|
if(textAreaDescription.getValue()==null)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
return textAreaDescription.getValue();
|
return textAreaDescription.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,25 +524,25 @@ public class DialogShareFolder extends Dialog {
|
||||||
* @return true, if is valid form
|
* @return true, if is valid form
|
||||||
*/
|
*/
|
||||||
public boolean isValidForm(boolean displayAlert){
|
public boolean isValidForm(boolean displayAlert){
|
||||||
|
|
||||||
if(!txtName.isValid()){
|
if(!txtName.isValid()){
|
||||||
if(displayAlert)
|
if(displayAlert)
|
||||||
new MessageBoxAlert("Attention", "Name must not be empty", null);
|
new MessageBoxAlert("Attention", "Name must not be empty", null);
|
||||||
txtName.focus();
|
txtName.focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getSharedListUsers().size()==0){
|
if(getSharedListUsers().size()==0){
|
||||||
if(displayAlert)
|
if(displayAlert)
|
||||||
new MessageBoxAlert("Attention", "You must pick at least one user with which share the folder", null);
|
new MessageBoxAlert("Attention", "You must pick at least one user with which share the folder", null);
|
||||||
suggestPanel.boxSetFocus();
|
suggestPanel.boxSetFocus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the selected acl.
|
* Gets the selected acl.
|
||||||
*
|
*
|
||||||
|
@ -551,7 +553,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
return permission.getSelectedACL();
|
return permission.getSelectedACL();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select acl for folder.
|
* Select acl for folder.
|
||||||
*
|
*
|
||||||
|
@ -564,7 +566,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable arg0) {
|
public void onFailure(Throwable arg0) {
|
||||||
GWT.log("An error occurred on selecting current ACL "+arg0);
|
GWT.log("An error occurred on selecting current ACL "+arg0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -575,7 +577,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
layout();
|
layout();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,76 +12,105 @@ import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
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{
|
public class UserStore implements ContactFetcher{
|
||||||
|
|
||||||
public static List<InfoContactModel> listAllContact = null;
|
public static List<InfoContactModel> listAllContact = null;
|
||||||
|
|
||||||
// public boolean syncronizeCleanSharedUser = false;
|
// public boolean syncronizeCleanSharedUser = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new user store.
|
||||||
|
*/
|
||||||
public UserStore() {
|
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
|
@Override
|
||||||
public void getListContact(AsyncCallback<List<InfoContactModel>> callback, boolean reloadList){
|
public void getListContact(AsyncCallback<List<InfoContactModel>> callback, boolean reloadList){
|
||||||
|
|
||||||
if(reloadList || listAllContact==null)
|
if(reloadList || listAllContact==null)
|
||||||
loadAllUsersFromServer(callback);
|
loadAllUsersFromServer(callback);
|
||||||
else
|
else
|
||||||
callback.onSuccess(listAllContact);
|
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
|
@Override
|
||||||
public void getListSharedUserByFolderId(String sharedFolderId, AsyncCallback<List<InfoContactModel>> callback){
|
public void getListSharedUserByFolderId(String sharedFolderId, AsyncCallback<List<InfoContactModel>> callback){
|
||||||
loadSharedUserBySharedFolderId(sharedFolderId, callback);
|
loadSharedUserBySharedFolderId(sharedFolderId, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load all users from server.
|
||||||
|
*
|
||||||
|
* @param callback the callback
|
||||||
|
*/
|
||||||
private void loadAllUsersFromServer(final AsyncCallback<List<InfoContactModel>> callback){
|
private void loadAllUsersFromServer(final AsyncCallback<List<InfoContactModel>> callback){
|
||||||
|
|
||||||
listAllContact = new ArrayList<InfoContactModel>();
|
listAllContact = new ArrayList<InfoContactModel>();
|
||||||
|
|
||||||
AppControllerExplorer.rpcWorkspaceService.getAllContacts(new AsyncCallback<List<InfoContactModel>>() {
|
AppControllerExplorer.rpcWorkspaceService.getAllContacts(new AsyncCallback<List<InfoContactModel>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<InfoContactModel> result) {
|
public void onSuccess(List<InfoContactModel> result) {
|
||||||
GWT.log("loaded "+result.size() + " contacts from server");
|
GWT.log("loaded "+result.size() + " contacts from server");
|
||||||
listAllContact = result;
|
listAllContact = result;
|
||||||
callback.onSuccess(listAllContact);
|
if(callback!=null)
|
||||||
|
callback.onSuccess(listAllContact);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR +" retrieving user " + ConstantsExplorer.TRY_AGAIN, null);
|
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR +" retrieving user " + ConstantsExplorer.TRY_AGAIN, null);
|
||||||
callback.onFailure(caught);
|
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){
|
private void loadSharedUserBySharedFolderId(final String sharedFolderId, final AsyncCallback<List<InfoContactModel>> callback){
|
||||||
|
|
||||||
// comboSharedUsers.mask("Loading users");
|
// comboSharedUsers.mask("Loading users");
|
||||||
|
|
||||||
AppControllerExplorer.rpcWorkspaceService.getListUserSharedByFolderSharedId(sharedFolderId, new AsyncCallback<List<InfoContactModel>>() {
|
AppControllerExplorer.rpcWorkspaceService.getListUserSharedByFolderSharedId(sharedFolderId, new AsyncCallback<List<InfoContactModel>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR +" retrieving user. " + ConstantsExplorer.TRY_AGAIN, null);
|
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR +" retrieving user. " + ConstantsExplorer.TRY_AGAIN, null);
|
||||||
callback.onFailure(caught);
|
if(callback!=null)
|
||||||
|
callback.onFailure(caught);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<InfoContactModel> result) {
|
public void onSuccess(List<InfoContactModel> result) {
|
||||||
GWT.log("loaded "+result.size() + " contacts from server for "+sharedFolderId);
|
GWT.log("loaded "+result.size() + " contacts from server for "+sharedFolderId);
|
||||||
callback.onSuccess(result);
|
if(callback!=null)
|
||||||
|
callback.onSuccess(result);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.gcube.portlets.user.workspace.client.view.sharing.ContactFetcher#getExclusiveContactsFromAllContact(java.util.List)
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<InfoContactModel> getExclusiveContactsFromAllContact(List<InfoContactModel> listSharedUser){
|
public List<InfoContactModel> getExclusiveContactsFromAllContact(List<InfoContactModel> listSharedUser){
|
||||||
|
|
||||||
List<InfoContactModel> listExclusiveContact = new ArrayList<InfoContactModel>(listAllContact);
|
List<InfoContactModel> listExclusiveContact = new ArrayList<InfoContactModel>(listAllContact);
|
||||||
for (InfoContactModel contact : listSharedUser) {
|
for (InfoContactModel contact : listSharedUser) {
|
||||||
if(listAllContact.contains(contact)){
|
if(listAllContact.contains(contact)){
|
||||||
|
@ -92,21 +121,24 @@ public class UserStore implements ContactFetcher{
|
||||||
return listExclusiveContact;
|
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
|
@Override
|
||||||
public void getOwner(final String sharedFolderId,final AsyncCallback<InfoContactModel> callback) {
|
public void getOwner(final String sharedFolderId,final AsyncCallback<InfoContactModel> callback) {
|
||||||
|
|
||||||
AppControllerExplorer.rpcWorkspaceService.getOwnerByItemId(sharedFolderId, new AsyncCallback<InfoContactModel>() {
|
AppControllerExplorer.rpcWorkspaceService.getOwnerByItemId(sharedFolderId, new AsyncCallback<InfoContactModel>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
GWT.log("an error occured in get Owner by Id "+sharedFolderId + " "+caught.getMessage());
|
GWT.log("an error occured in get Owner by Id "+sharedFolderId + " "+caught.getMessage());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(InfoContactModel result) {
|
public void onSuccess(InfoContactModel result) {
|
||||||
callback.onSuccess(result);
|
if(callback!=null)
|
||||||
|
callback.onSuccess(result);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1463,7 +1463,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
workspaceLogger.trace("Get all contacts from server...");
|
workspaceLogger.debug("Get all contacts from server...");
|
||||||
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
|
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
|
||||||
|
|
||||||
org.gcube.common.homelibrary.home.workspace.usermanager.UserManager hlUserManager = HomeLibrary.getHomeManagerFactory().getUserManager();
|
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");
|
workspaceLogger.trace("Home Library User Manager getting list Gcube Group");
|
||||||
listContactsModel.addAll(builder.buildGXTListContactsModelFromGcubeGroup(hlUserManager.getGroups()));
|
listContactsModel.addAll(builder.buildGXTListContactsModelFromGcubeGroup(hlUserManager.getGroups()));
|
||||||
|
|
||||||
|
workspaceLogger.debug("Returning list of contacts!");
|
||||||
return listContactsModel;
|
return listContactsModel;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.workspace.server.notifications;
|
package org.gcube.portlets.user.workspace.server.notifications;
|
||||||
|
|
||||||
|
@ -27,9 +27,9 @@ import org.gcube.portlets.user.workspace.server.util.WsUtil;
|
||||||
public class NotificationsProducer {
|
public class NotificationsProducer {
|
||||||
|
|
||||||
protected ScopeBean scope;
|
protected ScopeBean scope;
|
||||||
|
|
||||||
protected static Logger logger = Logger.getLogger(NotificationsProducer.class);
|
protected static Logger logger = Logger.getLogger(NotificationsProducer.class);
|
||||||
|
|
||||||
protected NotificationsManager notificationsMng;
|
protected NotificationsManager notificationsMng;
|
||||||
protected ASLSession aslSession;
|
protected ASLSession aslSession;
|
||||||
protected String userId;
|
protected String userId;
|
||||||
|
@ -72,7 +72,7 @@ public class NotificationsProducer {
|
||||||
public ASLSession getAslSession() {
|
public ASLSession getAslSession() {
|
||||||
return aslSession;
|
return aslSession;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs a new thread to notify the contacts passed in input.
|
* Runs a new thread to notify the contacts passed in input.
|
||||||
|
@ -85,22 +85,22 @@ public class NotificationsProducer {
|
||||||
new Thread(){
|
new Thread(){
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
logger.trace("Send notifies folder sharing is running...");
|
logger.trace("Send notifies folder sharing is running...");
|
||||||
|
|
||||||
for (InfoContactModel infoContactModel : listContacts) {
|
for (InfoContactModel infoContactModel : listContacts) {
|
||||||
try{
|
try{
|
||||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||||
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||||
|
|
||||||
logger.debug("Sending notification new share folder "+sharedFolder.getName()+" for user "+infoContactModel.getLogin());
|
logger.debug("Sending notification new share folder "+sharedFolder.getName()+" for user "+infoContactModel.getLogin());
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
// System.out.println("Sending notification new share folder "+sharedFolder.getName()+" for user "+infoContactModel.getLogin());
|
// System.out.println("Sending notification new share folder "+sharedFolder.getName()+" for user "+infoContactModel.getLogin());
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyFolderSharing(infoContactModel.getLogin(), sharedFolder);
|
boolean notify = notificationsMng.notifyFolderSharing(infoContactModel.getLogin(), sharedFolder);
|
||||||
|
|
||||||
|
|
||||||
if(!notify)
|
if(!notify)
|
||||||
logger.error("An error occured when notify user: "+infoContactModel.getLogin());
|
logger.error("An error occured when notify user: "+infoContactModel.getLogin());
|
||||||
}
|
}
|
||||||
|
@ -109,16 +109,16 @@ public class NotificationsProducer {
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace("notifies share folder is completed");
|
logger.trace("notifies share folder is completed");
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs a new thread to notify the contacts passed in input.
|
* Runs a new thread to notify the contacts passed in input.
|
||||||
*
|
*
|
||||||
|
@ -133,34 +133,34 @@ public class NotificationsProducer {
|
||||||
new Thread(){
|
new Thread(){
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
logger.trace("Send notifies shared folder was renamed is running...");
|
logger.trace("Send notifies shared folder was renamed is running...");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if(NotificationsUtil.checkIsRootFolderShared(folderItem.getId(), idsharedFolder)){
|
if(NotificationsUtil.checkIsRootFolderShared(folderItem.getId(), idsharedFolder)){
|
||||||
logger.trace("Notification isn't sent because the event is on root shared folder");
|
logger.trace("Notification isn't sent because the event is on root shared folder");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (InternalErrorException e1) {
|
} catch (InternalErrorException e1) {
|
||||||
logger.error("An error occurred in checkIsRootFolderShared ", e1);
|
logger.error("An error occurred in checkIsRootFolderShared ", e1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (InfoContactModel infoContactModel : listSharedContact) {
|
for (InfoContactModel infoContactModel : listSharedContact) {
|
||||||
try{
|
try{
|
||||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||||
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||||
|
|
||||||
logger.trace("Sending notification share folder "+itemOldName+" was renamed as " + itemNewName+ "for user "+infoContactModel.getLogin());
|
logger.trace("Sending notification share folder "+itemOldName+" was renamed as " + itemNewName+ "for user "+infoContactModel.getLogin());
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
System.out.println("Sending notification share folder "+itemOldName+" was renamed as " + itemNewName+ "for user "+infoContactModel.getLogin());
|
System.out.println("Sending notification share folder "+itemOldName+" was renamed as " + itemNewName+ "for user "+infoContactModel.getLogin());
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyFolderRenaming(infoContactModel.getLogin(), itemOldName, itemNewName, idsharedFolder);
|
boolean notify = notificationsMng.notifyFolderRenaming(infoContactModel.getLogin(), itemOldName, itemNewName, idsharedFolder);
|
||||||
|
|
||||||
|
|
||||||
if(!notify)
|
if(!notify)
|
||||||
logger.error("An error occured when notify user: "+infoContactModel.getLogin());
|
logger.error("An error occured when notify user: "+infoContactModel.getLogin());
|
||||||
}
|
}
|
||||||
|
@ -169,15 +169,15 @@ public class NotificationsProducer {
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace("notifies share folder was renamed is completed");
|
logger.trace("notifies share folder was renamed is completed");
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs a new thread to notify the contacts passed in input.
|
* Runs a new thread to notify the contacts passed in input.
|
||||||
*
|
*
|
||||||
|
@ -191,21 +191,21 @@ public class NotificationsProducer {
|
||||||
new Thread(){
|
new Thread(){
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
logger.trace("Send notifies shared item was updated is running...");
|
logger.trace("Send notifies shared item was updated is running...");
|
||||||
|
|
||||||
for (InfoContactModel infoContactModel : listSharedContact) {
|
for (InfoContactModel infoContactModel : listSharedContact) {
|
||||||
try{
|
try{
|
||||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||||
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||||
|
|
||||||
logger.trace("Sending notification to user "+infoContactModel.getLogin() + " updated item "+item.getName());
|
logger.trace("Sending notification to user "+infoContactModel.getLogin() + " updated item "+item.getName());
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
System.out.println("Sending notification to user "+infoContactModel.getLogin() + " updated item "+item.getName());
|
System.out.println("Sending notification to user "+infoContactModel.getLogin() + " updated item "+item.getName());
|
||||||
|
|
||||||
// notificationsMng.notifyItemRenaming(infoContactModel.getLogin(), previousName, item, sharedFolder);
|
// notificationsMng.notifyItemRenaming(infoContactModel.getLogin(), previousName, item, sharedFolder);
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyItemRenaming(infoContactModel.getLogin(), previousName, item, sharedFolder);
|
boolean notify = notificationsMng.notifyItemRenaming(infoContactModel.getLogin(), previousName, item, sharedFolder);
|
||||||
|
|
||||||
if(!notify)
|
if(!notify)
|
||||||
|
@ -216,14 +216,14 @@ public class NotificationsProducer {
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace("notifies shared item was updated is completed");
|
logger.trace("notifies shared item was updated is completed");
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs a new thread to notify the updated (add/remove) contacts to sharing
|
* Runs a new thread to notify the updated (add/remove) contacts to sharing
|
||||||
|
@ -237,88 +237,88 @@ public class NotificationsProducer {
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
|
||||||
//NEW USER SHARED
|
//NEW USER SHARED
|
||||||
DifferenceBetweenInfoContactModel diff = new DifferenceBetweenInfoContactModel(listSharingContact, listSharedContact);
|
DifferenceBetweenInfoContactModel diff = new DifferenceBetweenInfoContactModel(listSharingContact, listSharedContact);
|
||||||
|
|
||||||
List<InfoContactModel> listNewContactsShared = diff.getDifferentsContacts();
|
List<InfoContactModel> listNewContactsShared = diff.getDifferentsContacts();
|
||||||
|
|
||||||
logger.info("list new contacts shared: "+listNewContactsShared.size());
|
logger.info("list new contacts shared: "+listNewContactsShared.size());
|
||||||
|
|
||||||
if(listNewContactsShared.size()>0){
|
if(listNewContactsShared.size()>0){
|
||||||
|
|
||||||
if(listNewContactsShared.size()==1){ //CASE ONLY ONE CONTACS WAS ADDED
|
if(listNewContactsShared.size()==1){ //CASE ONLY ONE CONTACS WAS ADDED
|
||||||
|
|
||||||
InfoContactModel infoContactModel = listNewContactsShared.get(0);
|
InfoContactModel infoContactModel = listNewContactsShared.get(0);
|
||||||
|
|
||||||
for (InfoContactModel contact : listSharedContact) { //NOTIFIES ALREADY SHARED CONTACTS THAT A NEW USER WAS ADDED
|
for (InfoContactModel contact : listSharedContact) { //NOTIFIES ALREADY SHARED CONTACTS THAT A NEW USER WAS ADDED
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
|
||||||
logger.trace("Sending notification to user "+contact.getLogin()+", added user "+ infoContactModel.getLogin() +" to share folder "+sharedFolder.getName());
|
logger.trace("Sending notification to user "+contact.getLogin()+", added user "+ infoContactModel.getLogin() +" to share folder "+sharedFolder.getName());
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
// System.out.println("Sending notification added user "+ infoContactModel.getLogin() +" to share folder "+sharedFolder.getName() + " for user "+contact.getLogin());
|
// System.out.println("Sending notification added user "+ infoContactModel.getLogin() +" to share folder "+sharedFolder.getName() + " for user "+contact.getLogin());
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyFolderAddedUser(contact.getLogin(), sharedFolder, infoContactModel.getLogin());
|
boolean notify = notificationsMng.notifyFolderAddedUser(contact.getLogin(), sharedFolder, infoContactModel.getLogin());
|
||||||
|
|
||||||
if(!notify)
|
if(!notify)
|
||||||
logger.error("An error occured when notifies user: "+contact.getLogin());
|
logger.error("An error occured when notifies user: "+contact.getLogin());
|
||||||
|
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
logger.error("An error occured in notifyFolderAddedUser ", e);
|
logger.error("An error occured in notifyFolderAddedUser ", e);
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<InfoContactModel> listCts = new ArrayList<InfoContactModel>();
|
List<InfoContactModel> listCts = new ArrayList<InfoContactModel>();
|
||||||
listCts.add(infoContactModel);
|
listCts.add(infoContactModel);
|
||||||
notifyFolderSharing(listCts, sharedFolder); //NOTIFIER NEW USER OF SHARING FOLDER
|
notifyFolderSharing(listCts, sharedFolder); //NOTIFIER NEW USER OF SHARING FOLDER
|
||||||
|
|
||||||
}else{ //CASE MORE THEN ONE CONTACT WAS ADDED
|
}else{ //CASE MORE THEN ONE CONTACT WAS ADDED
|
||||||
|
|
||||||
List<String> listLogins = UserUtil.getListLoginByInfoContactModel(listNewContactsShared);
|
List<String> listLogins = UserUtil.getListLoginByInfoContactModel(listNewContactsShared);
|
||||||
|
|
||||||
for (InfoContactModel contact : listSharedContact) { //NOTIFIES ALREADY SHARED CONTACTS THATH A NEW USER WAS ADDED
|
for (InfoContactModel contact : listSharedContact) { //NOTIFIES ALREADY SHARED CONTACTS THATH A NEW USER WAS ADDED
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
|
||||||
logger.trace("Sending notification to user "+contact.getLogin()+", added "+listLogins.size()+" users to share folder "+sharedFolder.getName());
|
logger.trace("Sending notification to user "+contact.getLogin()+", added "+listLogins.size()+" users to share folder "+sharedFolder.getName());
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
// System.out.println("Sending notification added user "+ infoContactModel.getLogin() +" to share folder "+sharedFolder.getName() + " for user "+contact.getLogin());
|
// System.out.println("Sending notification added user "+ infoContactModel.getLogin() +" to share folder "+sharedFolder.getName() + " for user "+contact.getLogin());
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyFolderAddedUsers(contact.getLogin(), sharedFolder, listLogins);
|
boolean notify = notificationsMng.notifyFolderAddedUsers(contact.getLogin(), sharedFolder, listLogins);
|
||||||
|
|
||||||
if(!notify)
|
if(!notify)
|
||||||
logger.error("An error occured when notifies user: "+contact.getLogin());
|
logger.error("An error occured when notifies user: "+contact.getLogin());
|
||||||
|
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
logger.error("An error occured in notifyFolderAddedUser ", e);
|
logger.error("An error occured in notifyFolderAddedUser ", e);
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyFolderSharing(listNewContactsShared, sharedFolder); //NOTIFIER NEW USER OF SHARING FOLDER
|
notifyFolderSharing(listNewContactsShared, sharedFolder); //NOTIFIER NEW USER OF SHARING FOLDER
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//USER REMOVED FROM SHARE
|
//USER REMOVED FROM SHARE
|
||||||
DifferenceBetweenInfoContactModel diff2 = new DifferenceBetweenInfoContactModel(listSharedContact, listSharingContact);
|
DifferenceBetweenInfoContactModel diff2 = new DifferenceBetweenInfoContactModel(listSharedContact, listSharingContact);
|
||||||
|
|
||||||
List<InfoContactModel> listRemovedUsersFromShare = diff2.getDifferentsContacts();
|
List<InfoContactModel> listRemovedUsersFromShare = diff2.getDifferentsContacts();
|
||||||
|
|
||||||
logger.info("list removed contacts from share: "+listRemovedUsersFromShare.size());
|
logger.info("list removed contacts from share: "+listRemovedUsersFromShare.size());
|
||||||
|
|
||||||
if(listRemovedUsersFromShare.size()>0){
|
if(listRemovedUsersFromShare.size()>0){
|
||||||
|
|
||||||
for (InfoContactModel contact : listRemovedUsersFromShare)
|
for (InfoContactModel contact : listRemovedUsersFromShare)
|
||||||
notifyFolderRemovedUser(contact, sharedFolder);
|
notifyFolderRemovedUser(contact, sharedFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
logger.error("An error occured in notifyAddedUserToSharing ", e);
|
logger.error("An error occured in notifyAddedUserToSharing ", e);
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
|
@ -326,9 +326,9 @@ public class NotificationsProducer {
|
||||||
}
|
}
|
||||||
|
|
||||||
}.start();
|
}.start();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs a new thread to notify the contacts passed in input.
|
* Runs a new thread to notify the contacts passed in input.
|
||||||
|
@ -339,26 +339,26 @@ public class NotificationsProducer {
|
||||||
*/
|
*/
|
||||||
public void notifyFolderUnSharing(final List<InfoContactModel> listContacts, final String unShareFolderId, final String unSharedFolderName) {
|
public void notifyFolderUnSharing(final List<InfoContactModel> listContacts, final String unShareFolderId, final String unSharedFolderName) {
|
||||||
|
|
||||||
|
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
// printContacts(listContacts);
|
// printContacts(listContacts);
|
||||||
logger.trace("Send notifies folder un share is running...");
|
logger.trace("Send notifies folder un share is running...");
|
||||||
|
|
||||||
for (InfoContactModel infoContactModel : listContacts) {
|
for (InfoContactModel infoContactModel : listContacts) {
|
||||||
try{
|
try{
|
||||||
|
|
||||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||||
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||||
|
|
||||||
logger.trace("Sending notification to user "+infoContactModel.getLogin() +" unshare folder "+unSharedFolderName);
|
logger.trace("Sending notification to user "+infoContactModel.getLogin() +" unshare folder "+unSharedFolderName);
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
// System.out.println("Sending notification to user "+infoContactModel.getLogin() +" un shared folder "+unSharedFolder.getName());
|
// System.out.println("Sending notification to user "+infoContactModel.getLogin() +" un shared folder "+unSharedFolder.getName());
|
||||||
// boolean notify = notificationsMng.notifyFolderRemovedUser(infoContactModel.getLogin(), (WorkspaceSharedFolder) unSharedFolder);
|
// boolean notify = notificationsMng.notifyFolderRemovedUser(infoContactModel.getLogin(), (WorkspaceSharedFolder) unSharedFolder);
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyFolderUnsharing(infoContactModel.getLogin(), unShareFolderId, unSharedFolderName);
|
boolean notify = notificationsMng.notifyFolderUnsharing(infoContactModel.getLogin(), unShareFolderId, unSharedFolderName);
|
||||||
if(!notify)
|
if(!notify)
|
||||||
logger.error("An error occured when notifies user: "+infoContactModel.getLogin());
|
logger.error("An error occured when notifies user: "+infoContactModel.getLogin());
|
||||||
|
@ -368,12 +368,12 @@ public class NotificationsProducer {
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace("notifies of un share notifications is completed");
|
logger.trace("notifies of un share notifications is completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
}.start();
|
}.start();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -387,31 +387,31 @@ public class NotificationsProducer {
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
logger.trace("Send notifies removed user from shared folder is running...");
|
logger.trace("Send notifies removed user from shared folder is running...");
|
||||||
try{
|
try{
|
||||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||||
if(userUnShared.getLogin().compareTo(userId)!=0){
|
if(userUnShared.getLogin().compareTo(userId)!=0){
|
||||||
|
|
||||||
logger.debug("Sending notification to user "+userUnShared.getLogin() +" unshared from folder "+shareFolder.getName());
|
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)
|
if(!notify)
|
||||||
logger.error("An error occured when notifies user: "+userUnShared.getLogin());
|
logger.error("An error occured when notifies user: "+userUnShared.getLogin());
|
||||||
}
|
}
|
||||||
|
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
logger.error("An error occured in notifyFolderRemovedUser ", e);
|
logger.error("An error occured in notifyFolderRemovedUser ", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace("notifies of un unshare user is completed");
|
logger.trace("notifies of un unshare user is completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
}.start();
|
}.start();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs a new thread to notify the contacts passed in input.
|
* Runs a new thread to notify the contacts passed in input.
|
||||||
*
|
*
|
||||||
|
@ -424,27 +424,24 @@ public class NotificationsProducer {
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
// printContacts(listContacts);
|
// printContacts(listContacts);
|
||||||
logger.trace("Send notifies added item in sharedfolder is running...");
|
logger.trace("Send notifies added item in sharedfolder is running...");
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
System.out.println("Send notifies added item in sharedfolder is running...");
|
System.out.println("Send notifies added item in sharedfolder is running...");
|
||||||
|
|
||||||
for (InfoContactModel infoContactModel : listContacts) {
|
for (InfoContactModel infoContactModel : listContacts) {
|
||||||
try{
|
try{
|
||||||
|
|
||||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||||
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||||
|
|
||||||
logger.trace("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("Sending notification to user "+infoContactModel.getLogin() +" added item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
// System.out.println("Send notify folder un share user "+infoContactModel.getLogin());
|
// System.out.println("Send notify folder un share user "+infoContactModel.getLogin());
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyAddedItem(infoContactModel.getLogin(), workspaceItem, sharedFolder);
|
boolean notify = notificationsMng.notifyAddedItem(infoContactModel.getLogin(), workspaceItem, sharedFolder);
|
||||||
|
|
||||||
if(!notify){
|
if(!notify){
|
||||||
|
@ -458,17 +455,17 @@ public class NotificationsProducer {
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace("notifies of added item in shared folder is completed");
|
logger.trace("notifies of added item in shared folder is completed");
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
// System.out.println("notifies of added item in shared folder is completed");
|
// System.out.println("notifies of added item in shared folder is completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs a new thread to notify the contacts passed in input.
|
* Runs a new thread to notify the contacts passed in input.
|
||||||
*
|
*
|
||||||
|
@ -481,27 +478,27 @@ public class NotificationsProducer {
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
// printContacts(listContacts);
|
// printContacts(listContacts);
|
||||||
logger.trace("Send notifies updated item in shared folder is running...");
|
logger.trace("Send notifies updated item in shared folder is running...");
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
// System.out.println("Send notifies updated item in shared folder is running...");
|
// System.out.println("Send notifies updated item in shared folder is running...");
|
||||||
|
|
||||||
for (InfoContactModel infoContactModel : listContacts) {
|
for (InfoContactModel infoContactModel : listContacts) {
|
||||||
try{
|
try{
|
||||||
|
|
||||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||||
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||||
|
|
||||||
logger.trace("Sending notification to user "+infoContactModel.getLogin() +" updated item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
logger.trace("Sending notification to user "+infoContactModel.getLogin() +" updated item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
// System.out.println("Sending notification to user "+infoContactModel.getLogin() +" updated item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
// System.out.println("Sending notification to user "+infoContactModel.getLogin() +" updated item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
// System.out.println("Send notify folder un share user "+infoContactModel.getLogin());
|
// System.out.println("Send notify folder un share user "+infoContactModel.getLogin());
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyUpdatedItem(infoContactModel.getLogin(), workspaceItem, sharedFolder);
|
boolean notify = notificationsMng.notifyUpdatedItem(infoContactModel.getLogin(), workspaceItem, sharedFolder);
|
||||||
|
|
||||||
if(!notify){
|
if(!notify){
|
||||||
|
@ -515,20 +512,20 @@ public class NotificationsProducer {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace("notifies of updated item in shared folder is completed");
|
logger.trace("notifies of updated item in shared folder is completed");
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
// System.out.println("notifies of updated item in shared folder is completed");
|
// System.out.println("notifies of updated item in shared folder is completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs a new thread to notify the contacts passed in input.
|
* Runs a new thread to notify the contacts passed in input.
|
||||||
*
|
*
|
||||||
|
@ -538,38 +535,38 @@ public class NotificationsProducer {
|
||||||
*/
|
*/
|
||||||
public void notifyMovedItemToSharing(final List<InfoContactModel> listContacts, final WorkspaceItem workspaceItem, final WorkspaceSharedFolder sharedFolder) {
|
public void notifyMovedItemToSharing(final List<InfoContactModel> listContacts, final WorkspaceItem workspaceItem, final WorkspaceSharedFolder sharedFolder) {
|
||||||
|
|
||||||
|
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
logger.trace("Sending notification remove item in shared folder is running...");
|
logger.trace("Sending notification remove item in shared folder is running...");
|
||||||
// printContacts(listContacts);
|
// printContacts(listContacts);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if(NotificationsUtil.checkIsRootFolderShared(workspaceItem.getId(), sharedFolder.getId())){
|
if(NotificationsUtil.checkIsRootFolderShared(workspaceItem.getId(), sharedFolder.getId())){
|
||||||
logger.trace("Notification isn't sent because the event is on root shared folder");
|
logger.trace("Notification isn't sent because the event is on root shared folder");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (InternalErrorException e1) {
|
} catch (InternalErrorException e1) {
|
||||||
logger.error("An error occurred in checkIsRootFolderShared ", e1);
|
logger.error("An error occurred in checkIsRootFolderShared ", e1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace("Sending notification moved item in shared folder is running...");
|
logger.trace("Sending notification moved item in shared folder is running...");
|
||||||
|
|
||||||
// System.out.println("Sending notification moved item in shared folder is running...");
|
// System.out.println("Sending notification moved item in shared folder is running...");
|
||||||
|
|
||||||
for (InfoContactModel infoContactModel : listContacts) {
|
for (InfoContactModel infoContactModel : listContacts) {
|
||||||
try{
|
try{
|
||||||
|
|
||||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||||
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||||
|
|
||||||
logger.trace("Sending notification to user "+infoContactModel.getLogin() +" moved item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
logger.trace("Sending notification to user "+infoContactModel.getLogin() +" moved item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
// System.out.println("Sending notification to user "+infoContactModel.getLogin() +" moved item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
// System.out.println("Sending notification to user "+infoContactModel.getLogin() +" moved item "+workspaceItem.getName()+" in shared folder "+sharedFolder.getName());
|
||||||
|
|
||||||
|
@ -577,7 +574,7 @@ public class NotificationsProducer {
|
||||||
|
|
||||||
if(!notify){
|
if(!notify){
|
||||||
logger.error("An error occured when notify user: "+infoContactModel.getLogin());
|
logger.error("An error occured when notify user: "+infoContactModel.getLogin());
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
// System.out.println("An error occured when notify user: "+infoContactModel.getLogin());
|
// System.out.println("An error occured when notify user: "+infoContactModel.getLogin());
|
||||||
}
|
}
|
||||||
|
@ -587,20 +584,20 @@ public class NotificationsProducer {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace("notifies of moved item in shared folder is completed");
|
logger.trace("notifies of moved item in shared folder is completed");
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
// System.out.println("notifies of moved item in shared folder is completed");
|
// System.out.println("notifies of moved item in shared folder is completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}.start();
|
}.start();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs a new thread to notify the contacts passed in input.
|
* Runs a new thread to notify the contacts passed in input.
|
||||||
*
|
*
|
||||||
|
@ -610,35 +607,35 @@ public class NotificationsProducer {
|
||||||
*/
|
*/
|
||||||
public void notifyRemovedItemToSharing(final List<InfoContactModel> listContacts, final String itemName, final WorkspaceSharedFolder sharedFolder) {
|
public void notifyRemovedItemToSharing(final List<InfoContactModel> listContacts, final String itemName, final WorkspaceSharedFolder sharedFolder) {
|
||||||
|
|
||||||
|
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
logger.trace("Sending notification remove item in shared folder is running...");
|
logger.trace("Sending notification remove item in shared folder is running...");
|
||||||
// printContacts(listContacts);
|
// printContacts(listContacts);
|
||||||
|
|
||||||
if(itemName==null || itemName.isEmpty()){
|
if(itemName==null || itemName.isEmpty()){
|
||||||
logger.trace("Notification isn't sent - itemName is null or empty");
|
logger.trace("Notification isn't sent - itemName is null or empty");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sharedFolder==null){
|
if(sharedFolder==null){
|
||||||
logger.trace("Notification isn't sent - sharedFolder is null");
|
logger.trace("Notification isn't sent - sharedFolder is null");
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace("Sending notification removed item in shared folder is running...");
|
logger.trace("Sending notification removed item in shared folder is running...");
|
||||||
|
|
||||||
// System.out.println("Sending notification removed item in shared folder is running...");
|
// System.out.println("Sending notification removed item in shared folder is running...");
|
||||||
|
|
||||||
for (InfoContactModel infoContactModel : listContacts) {
|
for (InfoContactModel infoContactModel : listContacts) {
|
||||||
try{
|
try{
|
||||||
|
|
||||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||||
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||||
|
|
||||||
logger.trace("Sending notification to user "+infoContactModel.getLogin() +" removed item "+itemName+" in shared folder "+sharedFolder.getName());
|
logger.trace("Sending notification to user "+infoContactModel.getLogin() +" removed item "+itemName+" in shared folder "+sharedFolder.getName());
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
// System.out.println("Sending notification to user "+infoContactModel.getLogin() +" removed item "+itemName+" in shared folder "+sharedFolder.getName());
|
// System.out.println("Sending notification to user "+infoContactModel.getLogin() +" removed item "+itemName+" in shared folder "+sharedFolder.getName());
|
||||||
|
|
||||||
|
@ -646,7 +643,7 @@ public class NotificationsProducer {
|
||||||
|
|
||||||
if(!notify){
|
if(!notify){
|
||||||
logger.error("An error occured when notify user: "+infoContactModel.getLogin());
|
logger.error("An error occured when notify user: "+infoContactModel.getLogin());
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
// System.out.println("An error occured when notify user: "+infoContactModel.getLogin());
|
// System.out.println("An error occured when notify user: "+infoContactModel.getLogin());
|
||||||
}
|
}
|
||||||
|
@ -656,16 +653,16 @@ public class NotificationsProducer {
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace("notifies of moved item in shared folder is completed");
|
logger.trace("notifies of moved item in shared folder is completed");
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
// System.out.println("notifies of moved item in shared folder is completed");
|
// System.out.println("notifies of moved item in shared folder is completed");
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs a new thread to notify the contacts passed in input.
|
* Runs a new thread to notify the contacts passed in input.
|
||||||
*
|
*
|
||||||
|
@ -674,28 +671,28 @@ public class NotificationsProducer {
|
||||||
*/
|
*/
|
||||||
public void notifySharedFolderDeleted(final List<InfoContactModel> listContacts, final String folderNameDeleted) {
|
public void notifySharedFolderDeleted(final List<InfoContactModel> listContacts, final String folderNameDeleted) {
|
||||||
|
|
||||||
|
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
// printContacts(listContacts);
|
// printContacts(listContacts);
|
||||||
logger.trace("Send notifies shared folder deleted is running...");
|
logger.trace("Send notifies shared folder deleted is running...");
|
||||||
|
|
||||||
for (InfoContactModel infoContactModel : listContacts) {
|
for (InfoContactModel infoContactModel : listContacts) {
|
||||||
try{
|
try{
|
||||||
|
|
||||||
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
//NOTIFIES ONLY THE USERS THAT ARE DIFFERENT FROM CURRENT USER
|
||||||
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
if(infoContactModel.getLogin().compareTo(userId)!=0){
|
||||||
|
|
||||||
logger.trace("Sending notification to user "+infoContactModel.getLogin() +" deleted shared folder "+folderNameDeleted);
|
logger.trace("Sending notification to user "+infoContactModel.getLogin() +" deleted shared folder "+folderNameDeleted);
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
System.out.println("Sending notification to user "+infoContactModel.getLogin() +" deleted shared folder "+folderNameDeleted);
|
System.out.println("Sending notification to user "+infoContactModel.getLogin() +" deleted shared folder "+folderNameDeleted);
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
// boolean notify = notificationsMng.
|
// boolean notify = notificationsMng.
|
||||||
|
|
||||||
// if(!notify)
|
// if(!notify)
|
||||||
// logger.error("An error occured when notifies user: "+infoContactModel.getLogin());
|
// logger.error("An error occured when notifies user: "+infoContactModel.getLogin());
|
||||||
}
|
}
|
||||||
|
@ -704,14 +701,14 @@ public class NotificationsProducer {
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace("notifies of deleted shared foder is completed");
|
logger.trace("notifies of deleted shared foder is completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
}.start();
|
}.start();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs a new thread to notify the contacts passed in input.
|
* Runs a new thread to notify the contacts passed in input.
|
||||||
|
@ -724,14 +721,14 @@ public class NotificationsProducer {
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
// printContacts(listContacts);
|
// printContacts(listContacts);
|
||||||
logger.trace("Send notifies administrator upgrade is running...");
|
logger.trace("Send notifies administrator upgrade is running...");
|
||||||
if(userToNotify==null || userToNotify.getLogin()==null){
|
if(userToNotify==null || userToNotify.getLogin()==null){
|
||||||
logger.warn("Notification abort user to notify is null...");
|
logger.warn("Notification abort user to notify is null...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sharedFolder==null){
|
if(sharedFolder==null){
|
||||||
logger.warn("Notification abort sharedFolder to notify is null...");
|
logger.warn("Notification abort sharedFolder to notify is null...");
|
||||||
return;
|
return;
|
||||||
|
@ -739,21 +736,21 @@ public class NotificationsProducer {
|
||||||
try{
|
try{
|
||||||
String login = userToNotify.getLogin();
|
String login = userToNotify.getLogin();
|
||||||
logger.trace("Send notifies administrator upgrade for login: "+login);
|
logger.trace("Send notifies administrator upgrade for login: "+login);
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyAdministratorUpgrade(login, sharedFolder);
|
boolean notify = notificationsMng.notifyAdministratorUpgrade(login, sharedFolder);
|
||||||
logger.trace("Notification sent correctly? "+notify);
|
logger.trace("Notification sent correctly? "+notify);
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
logger.error("An error occured in notifyAdministratorUpgrade ", e);
|
logger.error("An error occured in notifyAdministratorUpgrade ", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
logger.trace("notifies of administrator upgrade completed");
|
logger.trace("notifies of administrator upgrade completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
}.start();
|
}.start();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs a new thread to notify the contacts passed in input.
|
* Runs a new thread to notify the contacts passed in input.
|
||||||
*
|
*
|
||||||
|
@ -765,14 +762,14 @@ public class NotificationsProducer {
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
// printContacts(listContacts);
|
// printContacts(listContacts);
|
||||||
logger.trace("Send notifies administrator Downgrade is running...");
|
logger.trace("Send notifies administrator Downgrade is running...");
|
||||||
if(userToNotify==null || userToNotify.getLogin()==null){
|
if(userToNotify==null || userToNotify.getLogin()==null){
|
||||||
logger.warn("Notification abort user to notify is null...");
|
logger.warn("Notification abort user to notify is null...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sharedFolder==null){
|
if(sharedFolder==null){
|
||||||
logger.warn("Notification abort sharedFolder to notify is null...");
|
logger.warn("Notification abort sharedFolder to notify is null...");
|
||||||
return;
|
return;
|
||||||
|
@ -780,19 +777,19 @@ public class NotificationsProducer {
|
||||||
try{
|
try{
|
||||||
String login = userToNotify.getLogin();
|
String login = userToNotify.getLogin();
|
||||||
logger.trace("Send notifies administrator Downgrade for login: "+login);
|
logger.trace("Send notifies administrator Downgrade for login: "+login);
|
||||||
|
|
||||||
boolean notify = notificationsMng.notifyAdministratorDowngrade(login, sharedFolder);
|
boolean notify = notificationsMng.notifyAdministratorDowngrade(login, sharedFolder);
|
||||||
logger.trace("Notification sent correctly? "+notify);
|
logger.trace("Notification sent correctly? "+notify);
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
logger.error("An error occured in notifyAdministratorDowngrade ", e);
|
logger.error("An error occured in notifyAdministratorDowngrade ", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
logger.trace("notifies of administrator Downgrade completed");
|
logger.trace("notifies of administrator Downgrade completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
}.start();
|
}.start();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
|
@ -802,7 +799,7 @@ public class NotificationsProducer {
|
||||||
* @param listContacts the list contacts
|
* @param listContacts the list contacts
|
||||||
*/
|
*/
|
||||||
private void printContacts(List<InfoContactModel> listContacts){
|
private void printContacts(List<InfoContactModel> listContacts){
|
||||||
|
|
||||||
System.out.println("Print contacts");
|
System.out.println("Print contacts");
|
||||||
for (InfoContactModel infoContactModel : listContacts) {
|
for (InfoContactModel infoContactModel : listContacts) {
|
||||||
System.out.println(infoContactModel);
|
System.out.println(infoContactModel);
|
||||||
|
@ -822,20 +819,20 @@ public class NotificationsProducer {
|
||||||
String user = "francesco.mangiacrapa";
|
String user = "francesco.mangiacrapa";
|
||||||
String scopeString = "/gcube/devsec/devVRE";
|
String scopeString = "/gcube/devsec/devVRE";
|
||||||
String fullName = "Francesco Mangiacrapa";
|
String fullName = "Francesco Mangiacrapa";
|
||||||
|
|
||||||
ScopeBean scope;
|
ScopeBean scope;
|
||||||
ASLSession session;
|
ASLSession session;
|
||||||
|
|
||||||
session = SessionManager.getInstance().getASLSession(sessionID, user);
|
session = SessionManager.getInstance().getASLSession(sessionID, user);
|
||||||
scope = new ScopeBean(scopeString);
|
scope = new ScopeBean(scopeString);
|
||||||
session.setScope(scope.toString());
|
session.setScope(scope.toString());
|
||||||
session.setUserAvatarId(user + "Avatar");
|
session.setUserAvatarId(user + "Avatar");
|
||||||
session.setUserFullName(fullName);
|
session.setUserFullName(fullName);
|
||||||
|
|
||||||
|
|
||||||
NotificationsProducer feeder = new NotificationsProducer(session);
|
NotificationsProducer feeder = new NotificationsProducer(session);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.workspace;
|
package org.gcube.portlets.user.workspace;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile;
|
||||||
/**
|
/**
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
* @Jun 18, 2013
|
* @Jun 18, 2013
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DonwloadServletTest {
|
public class DonwloadServletTest {
|
||||||
|
|
||||||
|
@ -38,37 +38,37 @@ public class DonwloadServletTest {
|
||||||
.getHome("francesco.mangiacrapa")
|
.getHome("francesco.mangiacrapa")
|
||||||
.getWorkspace();
|
.getWorkspace();
|
||||||
//
|
//
|
||||||
|
|
||||||
WorkspaceItem root = ws.getRoot();
|
WorkspaceItem root = ws.getRoot();
|
||||||
|
|
||||||
List<? extends WorkspaceItem> children = root.getChildren();
|
List<? extends WorkspaceItem> children = root.getChildren();
|
||||||
|
|
||||||
|
|
||||||
for (WorkspaceItem workspaceItem : children) {
|
for (WorkspaceItem workspaceItem : children) {
|
||||||
|
|
||||||
if(workspaceItem.getType().equals(WorkspaceItemType.FOLDER_ITEM)){
|
if(workspaceItem.getType().equals(WorkspaceItemType.FOLDER_ITEM)){
|
||||||
|
|
||||||
FolderItem folderItem = (FolderItem) workspaceItem;
|
FolderItem folderItem = (FolderItem) workspaceItem;
|
||||||
|
|
||||||
if(folderItem.getFolderItemType().equals(FolderItemType.EXTERNAL_FILE)){
|
if(folderItem.getFolderItemType().equals(FolderItemType.EXTERNAL_FILE)){
|
||||||
|
|
||||||
ExternalFile f = (ExternalFile) folderItem;
|
ExternalFile f = (ExternalFile) folderItem;
|
||||||
|
|
||||||
System.out.println("folderItem name: "+f.getName() + ", public link: "+f.getPublicLink());
|
System.out.println("folderItem name: "+f.getName() + ", public link: "+f.getPublicLink());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// WorkspaceItem item = ws.getItem("8ad4e104-0f34-413e-a88c-e754a81104e7");
|
// WorkspaceItem item = ws.getItem("8ad4e104-0f34-413e-a88c-e754a81104e7");
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// ExternalFile f = (ExternalFile) item;
|
// ExternalFile f = (ExternalFile) item;
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// System.out.println("Public link: "+f.getPublicLink());
|
// System.out.println("Public link: "+f.getPublicLink());
|
||||||
// FileOutputStream out = new FileOutputStream(new File("/tmp/bla"));
|
// FileOutputStream out = new FileOutputStream(new File("/tmp/bla"));
|
||||||
// // byte[] buffer = new byte[1024];
|
// // byte[] buffer = new byte[1024];
|
||||||
|
@ -77,10 +77,10 @@ public class DonwloadServletTest {
|
||||||
// // out.write(buffer, 0, len);
|
// // out.write(buffer, 0, len);
|
||||||
// // }
|
// // }
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
// is = f.getData();
|
// is = f.getData();
|
||||||
|
|
||||||
|
|
||||||
// IOUtils.copy(is, out);
|
// IOUtils.copy(is, out);
|
||||||
// is.close();
|
// is.close();
|
||||||
|
@ -96,23 +96,23 @@ public class DonwloadServletTest {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void depthVisit(WorkspaceItem item) throws InternalErrorException{
|
public void depthVisit(WorkspaceItem item) throws InternalErrorException{
|
||||||
|
|
||||||
|
|
||||||
if(item.getType().equals(WorkspaceItemType.FOLDER_ITEM)){
|
if(item.getType().equals(WorkspaceItemType.FOLDER_ITEM)){
|
||||||
|
|
||||||
WorkspaceFolder folder = (WorkspaceFolder) item;
|
WorkspaceFolder folder = (WorkspaceFolder) item;
|
||||||
System.out.println("Visit Folder: "+folder.getName());
|
System.out.println("Visit Folder: "+folder.getName());
|
||||||
List<? extends WorkspaceItem> children = folder.getChildren();
|
List<? extends WorkspaceItem> children = folder.getChildren();
|
||||||
|
|
||||||
for (WorkspaceItem workspaceItem : children) {
|
for (WorkspaceItem workspaceItem : children) {
|
||||||
depthVisit(workspaceItem);
|
depthVisit(workspaceItem);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
System.out.println("Item name: "+item.getName());
|
System.out.println("Item name: "+item.getName());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,9 @@ public class ItemRetrieve {
|
||||||
|
|
||||||
// public static String DEFAULT_SCOPE = "/d4science.research-infrastructures.eu/gCubeApps"; //PRODUCTION
|
// public static String DEFAULT_SCOPE = "/d4science.research-infrastructures.eu/gCubeApps"; //PRODUCTION
|
||||||
public static String DEFAULT_SCOPE = "/gcube/devsec"; //DEV
|
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 = "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
|
// d81d3a64-603f-4907-ae74-be8353211807
|
||||||
protected static Logger logger = Logger.getLogger(ItemRetrieve.class);
|
protected static Logger logger = Logger.getLogger(ItemRetrieve.class);
|
||||||
|
|
||||||
|
@ -48,14 +48,14 @@ public class ItemRetrieve {
|
||||||
Workspace ws = getWorkspace();
|
Workspace ws = getWorkspace();
|
||||||
|
|
||||||
System.out.println(ws.getRoot().getId());
|
System.out.println(ws.getRoot().getId());
|
||||||
// retrieveFirstLevel(ws, null);
|
retrieveFirstLevel(ws, null);
|
||||||
|
//
|
||||||
retrieveFirstLevel(ws, ITEMID);
|
// retrieveFirstLevel(ws, ITEMID);
|
||||||
|
//
|
||||||
System.out.println("get workspace -> OK");
|
// System.out.println("get workspace -> OK");
|
||||||
// WorkspaceItem item = ws.getItem(ITEMID);
|
WorkspaceItem item = ws.getItem(ITEMID);
|
||||||
// System.out.println("get item id: "+item.getId()+", name: "+item.getName() +", parent: "+item.getParent());
|
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);
|
System.out.println(item);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -119,50 +119,57 @@ public class ItemRetrieve {
|
||||||
int folderItemCounter = 0;
|
int folderItemCounter = 0;
|
||||||
int othersCounter = 0;
|
int othersCounter = 0;
|
||||||
for (WorkspaceItem workspaceItem : children) {
|
for (WorkspaceItem workspaceItem : children) {
|
||||||
|
try{
|
||||||
|
|
||||||
/*if(foundFolder!=null && !foundFolder.isEmpty()){
|
/*if(foundFolder!=null && !foundFolder.isEmpty()){
|
||||||
if(workspaceItem.getId().compareTo(foundFolder)==0){
|
if(workspaceItem.getId().compareTo(foundFolder)==0){
|
||||||
System.out.println("ITEM FOUND id: "+workspaceItem.getId()+", name: "+workspaceItem.getName());
|
System.out.println("ITEM FOUND id: "+workspaceItem.getId()+", name: "+workspaceItem.getName());
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
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());
|
||||||
|
foldersCounter++;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SHARED_FOLDER:
|
||||||
|
|
||||||
|
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());
|
||||||
|
|
||||||
|
// System.out.println(++i+") shared folder name: "+shared.getName() + " owner "+shared.getOwner().getPortalLogin());
|
||||||
|
sharedFoldersCounter++;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FOLDER_ITEM:
|
||||||
|
|
||||||
|
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());
|
||||||
|
folderItemCounter++;
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// System.out.println(++i+") DEFAULT - item id: "+workspaceItem.getId() +", name: "+workspaceItem.getName() + ", own: "+workspaceItem.getOwner());
|
||||||
|
// othersCounter++;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}*/
|
}catch (Exception e) {
|
||||||
|
// TODO: handle exception
|
||||||
|
|
||||||
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());
|
|
||||||
foldersCounter++;
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SHARED_FOLDER:
|
|
||||||
|
|
||||||
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 folder name: "+shared.getName() + " owner "+shared.getOwner().getPortalLogin());
|
|
||||||
sharedFoldersCounter++;
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FOLDER_ITEM:
|
|
||||||
|
|
||||||
FolderItem folderItem = (FolderItem) workspaceItem;
|
|
||||||
|
|
||||||
System.out.println(++i+") folderItem id: "+folderItem.getId() +", name: "+folderItem.getName() + ", own: "+folderItem.getOwner() +" path: "+folderItem.getPath());
|
|
||||||
folderItemCounter++;
|
|
||||||
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// System.out.println(++i+") DEFAULT - item id: "+workspaceItem.getId() +", name: "+workspaceItem.getName() + ", own: "+workspaceItem.getOwner());
|
|
||||||
// othersCounter++;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TEST TIME
|
//TEST TIME
|
||||||
|
|
Loading…
Reference in New Issue