messages with attachment support
This commit is contained in:
parent
3e624e687a
commit
46e5e2a787
|
@ -1,12 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/messages-2.5.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/messages-2.5.0/WEB-INF/classes" path="src/main/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry excluding="**" kind="src" output="target/messages-2.5.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
<classpathentry excluding="**" kind="src" output="target/messages-2.5.0/WEB-INF/classes" path="src/main/resources">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
@ -30,11 +30,11 @@
|
||||||
<attribute name="test" value="true"/>
|
<attribute name="test" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="src" output="target/messages-2.5.0-SNAPSHOT/WEB-INF/classes" path="target/generated-sources/gwt">
|
<classpathentry kind="src" output="target/messages-2.5.0/WEB-INF/classes" path="target/generated-sources/gwt">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/messages-2.5.0-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/messages-2.5.0/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,7 +11,10 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-module deploy-name="messages">
|
<wb-module deploy-name="messages">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +23,10 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +35,10 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,7 +47,10 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,12 +59,11 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,7 +72,10 @@
|
||||||
|
|
||||||
|
|
||||||
<property name="java-output-path" value="/message-conversations/target/message-conversations-0.0.1-SNAPSHOT/WEB-INF/classes"/>
|
<property name="java-output-path" value="/message-conversations/target/message-conversations-0.0.1-SNAPSHOT/WEB-INF/classes"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,7 +84,10 @@
|
||||||
|
|
||||||
|
|
||||||
<property name="context-root" value="messages"/>
|
<property name="context-root" value="messages"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,7 +96,10 @@
|
||||||
|
|
||||||
|
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -59,8 +59,8 @@ public class WriteMessage extends Composite {
|
||||||
@UiField MaterialAutoComplete acModal;
|
@UiField MaterialAutoComplete acModal;
|
||||||
@UiField MaterialButton btnSendModal, btnCloseModal;
|
@UiField MaterialButton btnSendModal, btnCloseModal;
|
||||||
@UiField MaterialPanel modalContent, sendingLoader;
|
@UiField MaterialPanel modalContent, sendingLoader;
|
||||||
// @UiField MaterialRow attachmentsRow;
|
@UiField MaterialRow attachmentsRow;
|
||||||
// @UiField MaterialLink attachButton;
|
@UiField MaterialLink attachButton;
|
||||||
@UiField MaterialLabel sendingFeedback;
|
@UiField MaterialLabel sendingFeedback;
|
||||||
@UiField MaterialPreLoader sendingSpinner;
|
@UiField MaterialPreLoader sendingSpinner;
|
||||||
@UiField MaterialTextArea txtArea;
|
@UiField MaterialTextArea txtArea;
|
||||||
|
@ -205,39 +205,39 @@ public class WriteMessage extends Composite {
|
||||||
toReturn.add(new WSUser("testing", "username testing", "Andrea testing", "@gmail.com"));
|
toReturn.add(new WSUser("testing", "username testing", "Andrea testing", "@gmail.com"));
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
// @UiHandler("attachButton")
|
@UiHandler("attachButton")
|
||||||
// void onAttach(ClickEvent e) {
|
void onAttach(ClickEvent e) {
|
||||||
// List<ItemType> types = new ArrayList<>();
|
List<ItemType> types = new ArrayList<>();
|
||||||
// ItemType[] theTypes = ItemType.values();
|
ItemType[] theTypes = ItemType.values();
|
||||||
// for (int i = 0; i < theTypes.length; i++) {
|
for (int i = 0; i < theTypes.length; i++) {
|
||||||
// if (theTypes[i] != ItemType.FOLDER)
|
if (theTypes[i] != ItemType.FOLDER)
|
||||||
// types.add(theTypes[i]);
|
types.add(theTypes[i]);
|
||||||
// }
|
}
|
||||||
// FilterCriteria criteria = null;
|
FilterCriteria criteria = null;
|
||||||
// final WorkspaceExplorerSelectDialog wpTreepopup = new WorkspaceExplorerSelectDialog("Select an item", criteria, types);
|
final WorkspaceExplorerSelectDialog wpTreepopup = new WorkspaceExplorerSelectDialog("Select an item", criteria, types);
|
||||||
// wpTreepopup.setId(Utils.ID_MODALBOOTSTRAP);
|
wpTreepopup.setId(Utils.ID_MODALBOOTSTRAP);
|
||||||
// wpTreepopup.getElement().getStyle().setLeft(50, Unit.PCT);
|
wpTreepopup.getElement().getStyle().setLeft(50, Unit.PCT);
|
||||||
// wpTreepopup.setZIndex(10010);
|
wpTreepopup.setZIndex(10010);
|
||||||
// WorskpaceExplorerSelectNotificationListener listener = new WorskpaceExplorerSelectNotificationListener() {
|
WorskpaceExplorerSelectNotificationListener listener = new WorskpaceExplorerSelectNotificationListener() {
|
||||||
// @Override
|
@Override
|
||||||
// public void onSelectedItem(Item item) {
|
public void onSelectedItem(Item item) {
|
||||||
// attachmentsRow.add(getChip(item.getId(), item.getName(), item.isFolder(), true));
|
attachmentsRow.add(getChip(item.getId(), item.getName(), item.isFolder(), true));
|
||||||
// wpTreepopup.hide();
|
wpTreepopup.hide();
|
||||||
// }
|
}
|
||||||
// @Override
|
@Override
|
||||||
// public void onFailed(Throwable throwable) {
|
public void onFailed(Throwable throwable) {
|
||||||
// Window.alert("There are networks problem, please check your connection.");
|
Window.alert("There are networks problem, please check your connection.");
|
||||||
// }
|
}
|
||||||
// @Override
|
@Override
|
||||||
// public void onAborted() {}
|
public void onAborted() {}
|
||||||
// @Override
|
@Override
|
||||||
// public void onNotValidSelection() {
|
public void onNotValidSelection() {
|
||||||
// }
|
}
|
||||||
// };
|
};
|
||||||
//
|
|
||||||
// wpTreepopup.addWorkspaceExplorerSelectNotificationListener(listener);
|
wpTreepopup.addWorkspaceExplorerSelectNotificationListener(listener);
|
||||||
// wpTreepopup.show();
|
wpTreepopup.show();
|
||||||
// }
|
}
|
||||||
|
|
||||||
//for the attachments we distinguish between folder and files
|
//for the attachments we distinguish between folder and files
|
||||||
private MaterialChip getChip(String itemId, String itemName, boolean isFolder, boolean deletable) {
|
private MaterialChip getChip(String itemId, String itemName, boolean isFolder, boolean deletable) {
|
||||||
|
@ -263,13 +263,13 @@ public class WriteMessage extends Composite {
|
||||||
|
|
||||||
private ArrayList<String> getSelectedFilesAndFoldersId() {
|
private ArrayList<String> getSelectedFilesAndFoldersId() {
|
||||||
ArrayList<String> toReturn = new ArrayList<>();
|
ArrayList<String> toReturn = new ArrayList<>();
|
||||||
// int n = attachmentsRow.getWidgetCount();
|
int n = attachmentsRow.getWidgetCount();
|
||||||
// for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
// Widget w = attachmentsRow.getWidget(i);
|
Widget w = attachmentsRow.getWidget(i);
|
||||||
// if (w instanceof MaterialChip) {
|
if (w instanceof MaterialChip) {
|
||||||
// toReturn.add(((MaterialChip) w).getId());
|
toReturn.add(((MaterialChip) w).getId());
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,6 +297,7 @@ public class WriteMessage extends Composite {
|
||||||
txtArea.reset();
|
txtArea.reset();
|
||||||
}
|
}
|
||||||
GWT.log(getSelectedUsers()+"");
|
GWT.log(getSelectedUsers()+"");
|
||||||
|
GWT.log(getSelectedFilesAndFoldersId()+"");
|
||||||
ArrayList<String> recipientIds = new ArrayList<>();
|
ArrayList<String> recipientIds = new ArrayList<>();
|
||||||
for (WSUser u : getSelectedUsers()) {
|
for (WSUser u : getSelectedUsers()) {
|
||||||
recipientIds.add(u.getScreenname());
|
recipientIds.add(u.getScreenname());
|
||||||
|
|
|
@ -44,12 +44,12 @@
|
||||||
<m:MaterialTextBox label="Subject" ui:field="txtBoxSubject"
|
<m:MaterialTextBox label="Subject" ui:field="txtBoxSubject"
|
||||||
marginBottom="0" />
|
marginBottom="0" />
|
||||||
</m:MaterialRow>
|
</m:MaterialRow>
|
||||||
<!-- <m:MaterialRow marginBottom="0"> -->
|
<m:MaterialRow marginBottom="0">
|
||||||
<!-- <m:MaterialLink href="#attach" text="Select files to attach" -->
|
<m:MaterialLink href="#attach" text="Select files to attach"
|
||||||
<!-- textColor="BLACK" iconType="ATTACHMENT" iconPosition="LEFT" -->
|
textColor="BLACK" iconType="ATTACHMENT" iconPosition="LEFT"
|
||||||
<!-- ui:field="attachButton" /> -->
|
ui:field="attachButton" />
|
||||||
<!-- </m:MaterialRow> -->
|
</m:MaterialRow>
|
||||||
<!-- <m:MaterialRow ui:field="attachmentsRow" marginBottom="0" /> -->
|
<m:MaterialRow ui:field="attachmentsRow" marginBottom="0" />
|
||||||
<m:MaterialRow>
|
<m:MaterialRow>
|
||||||
<m:MaterialTextArea ui:field="txtArea" label="Body" resizeRule="AUTO"/>
|
<m:MaterialTextArea ui:field="txtArea" label="Body" resizeRule="AUTO"/>
|
||||||
</m:MaterialRow>
|
</m:MaterialRow>
|
||||||
|
|
|
@ -13,10 +13,13 @@ import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser;
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.portal.PortalContext;
|
import org.gcube.common.portal.PortalContext;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
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.FileContainer;
|
||||||
|
import org.gcube.common.storagehub.client.dsl.OpenResolver;
|
||||||
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
|
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
|
||||||
import org.gcube.common.storagehub.client.plugins.AbstractPlugin;
|
import org.gcube.common.storagehub.client.plugins.AbstractPlugin;
|
||||||
import org.gcube.common.storagehub.client.proxies.MessageManagerClient;
|
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.FolderItem;
|
||||||
import org.gcube.common.storagehub.model.items.Item;
|
import org.gcube.common.storagehub.model.items.Item;
|
||||||
import org.gcube.common.storagehub.model.messages.Message;
|
import org.gcube.common.storagehub.model.messages.Message;
|
||||||
|
@ -368,12 +371,12 @@ public class ConvServiceImpl implements MessageService {
|
||||||
String checkedBody = body;
|
String checkedBody = body;
|
||||||
String messageId = client.sendMessage(recipientIds, checkedSubject, checkedBody, listAttachmentsId);
|
String messageId = client.sendMessage(recipientIds, checkedSubject, checkedBody, listAttachmentsId);
|
||||||
|
|
||||||
/*try {
|
try {
|
||||||
body += getPublicLinksForAttachs(listAttachmentsId);
|
body += getPublicLinksForAttachs(listAttachmentsId);
|
||||||
|
}
|
||||||
catch (StorageHubException e) {
|
catch (Exception e) {
|
||||||
_log.error("Ops, could not generate publick link for some of the attachments");
|
_log.error("Ops, could not generate publick link for some of the attachments");
|
||||||
}*/
|
}
|
||||||
_log.debug("Sending message notification to: " + recipientIds.toString());
|
_log.debug("Sending message notification to: " + recipientIds.toString());
|
||||||
|
|
||||||
List<GenericItemBean> recipients = getUsersbyUserId(recipientIds);
|
List<GenericItemBean> recipients = getUsersbyUserId(recipientIds);
|
||||||
|
@ -432,10 +435,8 @@ public class ConvServiceImpl implements MessageService {
|
||||||
* @throws ItemNotFoundException
|
* @throws ItemNotFoundException
|
||||||
* @throws InternalErrorException
|
* @throws InternalErrorException
|
||||||
*/
|
*/
|
||||||
/*
|
|
||||||
private String getPublicLinksForAttachs(ArrayList<String> listAttachments) {
|
private String getPublicLinksForAttachs(ArrayList<String> listAttachments) {
|
||||||
|
|
||||||
|
|
||||||
if (listAttachments != null && (!listAttachments.isEmpty()) ) {
|
if (listAttachments != null && (!listAttachments.isEmpty()) ) {
|
||||||
StorageHubClient client = new StorageHubClient();
|
StorageHubClient client = new StorageHubClient();
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
@ -449,22 +450,21 @@ public class ConvServiceImpl implements MessageService {
|
||||||
|
|
||||||
if(openResolver.asItem().getType()==ContainerType.FOLDER) {
|
if(openResolver.asItem().getType()==ContainerType.FOLDER) {
|
||||||
|
|
||||||
String publicLink = openResolver.getPublickLink(itemId).toString();;
|
String publicLink = openResolver.asFile().getPublicLink(itemId).toString();
|
||||||
String itemName = item.getTitle();
|
String itemName = openResolver.asFile().get().getTitle();
|
||||||
|
|
||||||
builder.append(itemName + " ("+publicLink+")");
|
builder.append(itemName + " ("+publicLink+")");
|
||||||
builder.append("\n");
|
builder.append("\n");
|
||||||
}catch (StorageHubException e) {
|
}
|
||||||
|
} catch (StorageHubException e) {
|
||||||
_log.error("While reading attachments");
|
_log.error("While reading attachments");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_log.debug("returning public links: "+builder.toString());
|
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
else return "";
|
return "";
|
||||||
}*/
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue