diff --git a/.classpath b/.classpath
index 70f4612..7e59c31 100644
--- a/.classpath
+++ b/.classpath
@@ -1,12 +1,12 @@
-
+
-
+
@@ -30,11 +30,11 @@
-
+
-
+
diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component
index e19deb5..19afbf8 100644
--- a/.settings/org.eclipse.wst.common.component
+++ b/.settings/org.eclipse.wst.common.component
@@ -1,5 +1,8 @@
-
+
+
+
+
@@ -8,7 +11,10 @@
-
+
+
+
+
@@ -17,7 +23,10 @@
-
+
+
+
+
@@ -26,7 +35,10 @@
-
+
+
+
+
@@ -35,7 +47,10 @@
-
+
+
+
+
@@ -44,12 +59,11 @@
-
-
-
-
-
+
+
+
+
@@ -58,7 +72,10 @@
-
+
+
+
+
@@ -67,7 +84,10 @@
-
+
+
+
+
@@ -76,7 +96,10 @@
-
+
+
+
+
diff --git a/src/main/java/org/gcube/portets/user/message_conversations/client/ui/WriteMessage.java b/src/main/java/org/gcube/portets/user/message_conversations/client/ui/WriteMessage.java
index 955e560..421e7eb 100644
--- a/src/main/java/org/gcube/portets/user/message_conversations/client/ui/WriteMessage.java
+++ b/src/main/java/org/gcube/portets/user/message_conversations/client/ui/WriteMessage.java
@@ -59,8 +59,8 @@ public class WriteMessage extends Composite {
@UiField MaterialAutoComplete acModal;
@UiField MaterialButton btnSendModal, btnCloseModal;
@UiField MaterialPanel modalContent, sendingLoader;
-// @UiField MaterialRow attachmentsRow;
-// @UiField MaterialLink attachButton;
+ @UiField MaterialRow attachmentsRow;
+ @UiField MaterialLink attachButton;
@UiField MaterialLabel sendingFeedback;
@UiField MaterialPreLoader sendingSpinner;
@UiField MaterialTextArea txtArea;
@@ -205,39 +205,39 @@ public class WriteMessage extends Composite {
toReturn.add(new WSUser("testing", "username testing", "Andrea testing", "@gmail.com"));
return toReturn;
}
-// @UiHandler("attachButton")
-// void onAttach(ClickEvent e) {
-// List types = new ArrayList<>();
-// ItemType[] theTypes = ItemType.values();
-// for (int i = 0; i < theTypes.length; i++) {
-// if (theTypes[i] != ItemType.FOLDER)
-// types.add(theTypes[i]);
-// }
-// FilterCriteria criteria = null;
-// final WorkspaceExplorerSelectDialog wpTreepopup = new WorkspaceExplorerSelectDialog("Select an item", criteria, types);
-// wpTreepopup.setId(Utils.ID_MODALBOOTSTRAP);
-// wpTreepopup.getElement().getStyle().setLeft(50, Unit.PCT);
-// wpTreepopup.setZIndex(10010);
-// WorskpaceExplorerSelectNotificationListener listener = new WorskpaceExplorerSelectNotificationListener() {
-// @Override
-// public void onSelectedItem(Item item) {
-// attachmentsRow.add(getChip(item.getId(), item.getName(), item.isFolder(), true));
-// wpTreepopup.hide();
-// }
-// @Override
-// public void onFailed(Throwable throwable) {
-// Window.alert("There are networks problem, please check your connection.");
-// }
-// @Override
-// public void onAborted() {}
-// @Override
-// public void onNotValidSelection() {
-// }
-// };
-//
-// wpTreepopup.addWorkspaceExplorerSelectNotificationListener(listener);
-// wpTreepopup.show();
-// }
+ @UiHandler("attachButton")
+ void onAttach(ClickEvent e) {
+ List types = new ArrayList<>();
+ ItemType[] theTypes = ItemType.values();
+ for (int i = 0; i < theTypes.length; i++) {
+ if (theTypes[i] != ItemType.FOLDER)
+ types.add(theTypes[i]);
+ }
+ FilterCriteria criteria = null;
+ final WorkspaceExplorerSelectDialog wpTreepopup = new WorkspaceExplorerSelectDialog("Select an item", criteria, types);
+ wpTreepopup.setId(Utils.ID_MODALBOOTSTRAP);
+ wpTreepopup.getElement().getStyle().setLeft(50, Unit.PCT);
+ wpTreepopup.setZIndex(10010);
+ WorskpaceExplorerSelectNotificationListener listener = new WorskpaceExplorerSelectNotificationListener() {
+ @Override
+ public void onSelectedItem(Item item) {
+ attachmentsRow.add(getChip(item.getId(), item.getName(), item.isFolder(), true));
+ wpTreepopup.hide();
+ }
+ @Override
+ public void onFailed(Throwable throwable) {
+ Window.alert("There are networks problem, please check your connection.");
+ }
+ @Override
+ public void onAborted() {}
+ @Override
+ public void onNotValidSelection() {
+ }
+ };
+
+ wpTreepopup.addWorkspaceExplorerSelectNotificationListener(listener);
+ wpTreepopup.show();
+ }
//for the attachments we distinguish between folder and files
private MaterialChip getChip(String itemId, String itemName, boolean isFolder, boolean deletable) {
@@ -263,13 +263,13 @@ public class WriteMessage extends Composite {
private ArrayList getSelectedFilesAndFoldersId() {
ArrayList toReturn = new ArrayList<>();
-// int n = attachmentsRow.getWidgetCount();
-// for (int i = 0; i < n; i++) {
-// Widget w = attachmentsRow.getWidget(i);
-// if (w instanceof MaterialChip) {
-// toReturn.add(((MaterialChip) w).getId());
-// }
-// }
+ int n = attachmentsRow.getWidgetCount();
+ for (int i = 0; i < n; i++) {
+ Widget w = attachmentsRow.getWidget(i);
+ if (w instanceof MaterialChip) {
+ toReturn.add(((MaterialChip) w).getId());
+ }
+ }
return toReturn;
}
@@ -297,6 +297,7 @@ public class WriteMessage extends Composite {
txtArea.reset();
}
GWT.log(getSelectedUsers()+"");
+ GWT.log(getSelectedFilesAndFoldersId()+"");
ArrayList recipientIds = new ArrayList<>();
for (WSUser u : getSelectedUsers()) {
recipientIds.add(u.getScreenname());
diff --git a/src/main/java/org/gcube/portets/user/message_conversations/client/ui/WriteMessage.ui.xml b/src/main/java/org/gcube/portets/user/message_conversations/client/ui/WriteMessage.ui.xml
index fee39c5..f487264 100644
--- a/src/main/java/org/gcube/portets/user/message_conversations/client/ui/WriteMessage.ui.xml
+++ b/src/main/java/org/gcube/portets/user/message_conversations/client/ui/WriteMessage.ui.xml
@@ -44,12 +44,12 @@
-
-
-
-
-
-
+
+
+
+
diff --git a/src/main/java/org/gcube/portets/user/message_conversations/server/ConvServiceImpl.java b/src/main/java/org/gcube/portets/user/message_conversations/server/ConvServiceImpl.java
index d6b6ca6..4135000 100644
--- a/src/main/java/org/gcube/portets/user/message_conversations/server/ConvServiceImpl.java
+++ b/src/main/java/org/gcube/portets/user/message_conversations/server/ConvServiceImpl.java
@@ -13,10 +13,13 @@ import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.portal.PortalContext;
import org.gcube.common.scope.api.ScopeProvider;
+import org.gcube.common.storagehub.client.dsl.ContainerType;
import org.gcube.common.storagehub.client.dsl.FileContainer;
+import org.gcube.common.storagehub.client.dsl.OpenResolver;
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
import org.gcube.common.storagehub.client.plugins.AbstractPlugin;
import org.gcube.common.storagehub.client.proxies.MessageManagerClient;
+import org.gcube.common.storagehub.model.exceptions.StorageHubException;
import org.gcube.common.storagehub.model.items.FolderItem;
import org.gcube.common.storagehub.model.items.Item;
import org.gcube.common.storagehub.model.messages.Message;
@@ -368,12 +371,12 @@ public class ConvServiceImpl implements MessageService {
String checkedBody = body;
String messageId = client.sendMessage(recipientIds, checkedSubject, checkedBody, listAttachmentsId);
- /*try {
+ try {
body += getPublicLinksForAttachs(listAttachmentsId);
-
- catch (StorageHubException e) {
+ }
+ catch (Exception e) {
_log.error("Ops, could not generate publick link for some of the attachments");
- }*/
+ }
_log.debug("Sending message notification to: " + recipientIds.toString());
List recipients = getUsersbyUserId(recipientIds);
@@ -432,10 +435,8 @@ public class ConvServiceImpl implements MessageService {
* @throws ItemNotFoundException
* @throws InternalErrorException
*/
- /*
+
private String getPublicLinksForAttachs(ArrayList listAttachments) {
-
-
if (listAttachments != null && (!listAttachments.isEmpty()) ) {
StorageHubClient client = new StorageHubClient();
StringBuilder builder = new StringBuilder();
@@ -449,22 +450,21 @@ public class ConvServiceImpl implements MessageService {
if(openResolver.asItem().getType()==ContainerType.FOLDER) {
- String publicLink = openResolver.getPublickLink(itemId).toString();;
- String itemName = item.getTitle();
+ String publicLink = openResolver.asFile().getPublicLink(itemId).toString();
+ String itemName = openResolver.asFile().get().getTitle();
builder.append(itemName + " ("+publicLink+")");
builder.append("\n");
- }catch (StorageHubException e) {
+ }
+ } catch (StorageHubException e) {
_log.error("While reading attachments");
e.printStackTrace();
- }
- }
+ }
}
- _log.debug("returning public links: "+builder.toString());
return builder.toString();
- }
- else return "";
- }*/
+ }
+ return "";
+ }
/**