added intermediate object for WorkspaceMessages
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/social-networking/social-networking-service-model@163353 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
98800d24ae
commit
9981a29e90
|
@ -0,0 +1,138 @@
|
|||
package org.gcube.portal.socialnetworking.model.input;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
/**
|
||||
* Used for serialization of {@link org.gcube.common.homelibrary.home.workspace.sharing.WorkspaceMessage}
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public class Message {
|
||||
|
||||
@JsonProperty("id")
|
||||
private String id;
|
||||
|
||||
@JsonProperty("subject")
|
||||
@NotNull
|
||||
private String subject;
|
||||
|
||||
@JsonProperty("body")
|
||||
@NotNull
|
||||
private String body;
|
||||
|
||||
@JsonProperty("sender")
|
||||
private String senderId;
|
||||
|
||||
@JsonProperty("send_time")
|
||||
private Calendar sendTime;
|
||||
|
||||
@JsonProperty("read")
|
||||
private boolean read;
|
||||
|
||||
@JsonProperty("attachment_ids")
|
||||
private List<String> attachmentIds;
|
||||
|
||||
@JsonProperty("recipients")
|
||||
@NotNull
|
||||
private List<Recipient> recipients;
|
||||
|
||||
public Message() {
|
||||
super();
|
||||
}
|
||||
|
||||
public Message(String id, String subject, String body,
|
||||
String senderId, Calendar sendTime, boolean read,
|
||||
List<String> attachmentIds, List<Recipient> recipients) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.subject = subject;
|
||||
this.body = body;
|
||||
this.senderId = senderId;
|
||||
this.sendTime = sendTime;
|
||||
this.read = read;
|
||||
this.attachmentIds = attachmentIds;
|
||||
this.recipients = recipients;
|
||||
}
|
||||
|
||||
public Message(String subject, String body, ArrayList<Recipient> recipients) {
|
||||
this.subject = subject;
|
||||
this.body = body;
|
||||
this.recipients = recipients;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getSubject() {
|
||||
return subject;
|
||||
}
|
||||
|
||||
public void setSubject(String subject) {
|
||||
this.subject = subject;
|
||||
}
|
||||
|
||||
public String getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public void setBody(String body) {
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public String getSenderId() {
|
||||
return senderId;
|
||||
}
|
||||
|
||||
public void setSenderId(String senderId) {
|
||||
this.senderId = senderId;
|
||||
}
|
||||
|
||||
public Calendar getSendTime() {
|
||||
return sendTime;
|
||||
}
|
||||
|
||||
public void setSendTime(Calendar sendTime) {
|
||||
this.sendTime = sendTime;
|
||||
}
|
||||
|
||||
public boolean isRead() {
|
||||
return read;
|
||||
}
|
||||
|
||||
public void setRead(boolean read) {
|
||||
this.read = read;
|
||||
}
|
||||
|
||||
public List<String> getAttachmentIds() {
|
||||
return attachmentIds;
|
||||
}
|
||||
|
||||
public void setAttachmentIds(List<String> attachmentIds) {
|
||||
this.attachmentIds = attachmentIds;
|
||||
}
|
||||
|
||||
public List<Recipient> getRecipients() {
|
||||
return recipients;
|
||||
}
|
||||
|
||||
public void setRecipients(List<Recipient> recipients) {
|
||||
this.recipients = recipients;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MessageOutputBeanMixIn [id=" + id + ", subject=" + subject
|
||||
+ ", body=" + body + ", senderId=" + senderId + ", sendTime="
|
||||
+ sendTime + ", read=" + read + ", attachmentIds="
|
||||
+ attachmentIds + ", recipients=" + recipients + "]";
|
||||
}
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
package org.gcube.portal.socialnetworking.model.input;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* Generic input bean for methods that allow to write messages
|
||||
* @author Costantino Perciante at ISTI-CNR
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true) // ignore in serialization/deserialization
|
||||
public class MessageInputBean implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -1317811686036127456L;
|
||||
|
||||
@JsonProperty("body")
|
||||
@NotNull(message="body cannot be missing")
|
||||
@Size(min=1, message="body cannot be empty")
|
||||
private String body;
|
||||
|
||||
@JsonProperty("subject")
|
||||
@NotNull(message="subject cannot be missing")
|
||||
@Size(min=1, message="subject cannot be empty")
|
||||
private String subject;
|
||||
|
||||
@JsonProperty("recipients")
|
||||
@NotNull(message="recipients cannot be missing")
|
||||
@Size(min=1, message="at least a recipient is needed")
|
||||
@Valid // validate recursively
|
||||
private ArrayList<Recipient> recipients;
|
||||
|
||||
public MessageInputBean(){
|
||||
super();
|
||||
}
|
||||
|
||||
public MessageInputBean(String body, String subject,
|
||||
ArrayList<Recipient> recipients) {
|
||||
super();
|
||||
//this.sender = sender;
|
||||
this.body = body;
|
||||
this.subject = subject;
|
||||
this.recipients = recipients;
|
||||
}
|
||||
|
||||
public String getBody() {
|
||||
return body;
|
||||
}
|
||||
public void setBody(String body) {
|
||||
this.body = body;
|
||||
}
|
||||
public String getSubject() {
|
||||
return subject;
|
||||
}
|
||||
public void setSubject(String subject) {
|
||||
this.subject = subject;
|
||||
}
|
||||
public ArrayList<Recipient> getRecipients() {
|
||||
return recipients;
|
||||
}
|
||||
public void setRecipients(ArrayList<Recipient> recipients) {
|
||||
this.recipients = recipients;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MessageInputBean ["
|
||||
+ (body != null ? "body=" + body + ", " : "")
|
||||
+ (subject != null ? "subject=" + subject + ", " : "")
|
||||
+ (recipients != null ? "recipients=" + recipients : "") + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
package org.gcube.portal.socialnetworking.model.output;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import javax.jcr.ItemNotFoundException;
|
||||
|
||||
import org.gcube.common.homelibrary.home.User;
|
||||
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
||||
import org.gcube.common.homelibrary.home.workspace.exceptions.WrongDestinationException;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
/**
|
||||
* Used for serialization of {@link org.gcube.common.homelibrary.home.workspace.sharing.WorkspaceMessage}
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public interface MessageOutputBeanMixIn {
|
||||
|
||||
@JsonProperty("id")
|
||||
String getId();
|
||||
|
||||
@JsonProperty("subject")
|
||||
String getSubject();
|
||||
|
||||
@JsonProperty("body")
|
||||
String getBody();
|
||||
|
||||
@JsonProperty("sender")
|
||||
User getSender();
|
||||
|
||||
@JsonProperty("send_time")
|
||||
Calendar getSendTime();
|
||||
|
||||
@JsonProperty("read")
|
||||
boolean isRead();
|
||||
|
||||
@JsonProperty("attachments_ids")
|
||||
List<String> getAttachmentsIds();
|
||||
|
||||
@JsonProperty("recipients")
|
||||
List<String> getAddresses();
|
||||
|
||||
@JsonIgnore
|
||||
void setStatus(boolean status) throws InternalErrorException;
|
||||
|
||||
@JsonIgnore
|
||||
List<WorkspaceItem> getAttachments() throws InternalErrorException;
|
||||
|
||||
@JsonIgnore
|
||||
WorkspaceItem saveAttachment(String attachmentId, String destinationFolderId)
|
||||
throws InternalErrorException, WrongDestinationException,
|
||||
ItemNotFoundException;
|
||||
|
||||
@JsonIgnore
|
||||
void open() throws InternalErrorException;
|
||||
|
||||
@JsonIgnore
|
||||
List<String> getCopyAttachmentsIds();
|
||||
|
||||
}
|
Loading…
Reference in New Issue