support attachments for write message

This commit is contained in:
Massimiliano Assante 2022-10-20 14:45:17 +02:00
parent 1455a59ac8
commit 3b367774cc
4 changed files with 33 additions and 11 deletions

View File

@ -1,10 +1,11 @@
# Changelog
## [v2.7.1-SNAPSHOT] - 2022-10-20
## [v2.8.0-SNAPSHOT] - 2022-10-20
- Feature #23891 Refactored following updates social lib
- Feature #23847 Social service: temporarily block of notifications for given username(s)
- Feature #23439: Please allow an IAM client to send notifications OPEN
- Feature #23991 Support attachments through notification / message API
## [v2.7.0] - 2022-09-12

View File

@ -12,7 +12,7 @@
<groupId>org.gcube.portal</groupId>
<artifactId>social-networking-library-ws</artifactId>
<packaging>war</packaging>
<version>2.7.1-SNAPSHOT</version>
<version>2.8.0-SNAPSHOT</version>
<name>social-networking-library-ws</name>
<description>Rest interface for the social networking library.</description>
<properties>

View File

@ -38,6 +38,13 @@ public class MessageInputBean implements Serializable {
@Size(min=1, message="at least a recipient is needed")
@Valid // validate recursively
private ArrayList<Recipient> recipients;
/**
* a list of workspace item id valid in the workspace of the sender
*/
@JsonProperty("attachmentIds")
@Valid // validate recursively
private ArrayList<String> attachmentIds;
public MessageInputBean() {
super();
@ -50,8 +57,19 @@ public class MessageInputBean implements Serializable {
this.body = body;
this.subject = subject;
this.recipients = recipients;
this.attachmentIds = new ArrayList<>();
}
public MessageInputBean(String sender, String body, String subject,
ArrayList<Recipient> recipients, ArrayList<String> attachmentIds) {
super();
//this.sender = sender;
this.body = body;
this.subject = subject;
this.recipients = recipients;
this.attachmentIds = attachmentIds;
}
public String getBody() {
return body;
}
@ -71,14 +89,17 @@ public class MessageInputBean implements Serializable {
this.recipients = recipients;
}
@Override
public String toString() {
return "MessageInputBean ["
+ (body != null ? "body=" + body + ", " : "")
+ (subject != null ? "subject=" + subject + ", " : "")
+ (recipients != null ? "recipients=" + recipients : "") + "]";
public ArrayList<String> getAttachmentIds() {
return attachmentIds;
}
public void setAttachmentIds(ArrayList<String> attachmentIds) {
this.attachmentIds = attachmentIds;
}
@Override
public String toString() {
return "MessageInputBean [body=" + body + ", subject=" + subject + ", recipients=" + recipients
+ ", attachmentIds=" + attachmentIds + "]";
}
}

View File

@ -155,7 +155,7 @@ public class Messages {
// send message
MessageManagerClient client = AbstractPlugin.messages().build();
logger.debug("Sending message to " + recipientsListFiltered);
String messageId = client.sendMessage(recipientsListFiltered, subject, body, null);
String messageId = client.sendMessage(recipientsListFiltered, subject, body, input.getAttachmentIds());
// send notification
logger.debug("Message sent to " + recipientsIds + ". Sending message notification to: " + recipientsIds);