From 4faa9389080debcc4a077927848bcc39796b7a4b Mon Sep 17 00:00:00 2001 From: Alfredo Oliviero Date: Fri, 25 Oct 2024 18:44:26 +0200 Subject: [PATCH] v1.4.0. messages in cassandra --- CHANGELOG.md | 4 + README.md | 2 +- pom.xml | 17 +- .../model/beans/messages/Message.java | 148 ++++++++++++++++++ .../beans/{ => messages}/MessageInbox.java | 8 +- .../{ => messages}/MessageInputBean.java | 4 +- .../model/beans/messages/Owner.java | 31 ++++ 7 files changed, 196 insertions(+), 18 deletions(-) create mode 100644 src/main/java/org/gcube/social_networking/socialnetworking/model/beans/messages/Message.java rename src/main/java/org/gcube/social_networking/socialnetworking/model/beans/{ => messages}/MessageInbox.java (83%) rename src/main/java/org/gcube/social_networking/socialnetworking/model/beans/{ => messages}/MessageInputBean.java (96%) create mode 100644 src/main/java/org/gcube/social_networking/socialnetworking/model/beans/messages/Owner.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ec3605..2bdce93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [v1.4.0-SNAPSHOT] + +- moved messages from storagehub to cassandra [#27514] + ## [v1.3.0] - 2024-10-25 - Feature #27999 [StorageHub] downstream components to upgrade in order to work with storagehub 1.5.0 diff --git a/README.md b/README.md index 9f09683..b4aba0d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## Structure of the project -* The source code is present in the src folder. +* The source code is present in the src folder. ## Built With diff --git a/pom.xml b/pom.xml index 51ab238..97d963c 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ org.gcube.social-networking social-service-model - 1.3.0 + 1.4.0-SNAPSHOT jar social-networking-service-model Social networking service model classes @@ -48,6 +48,12 @@ + + com.webcohesion.enunciate @@ -61,21 +67,12 @@ ${enunciate.version} provided - - org.gcube.common - storagehub-model - org.projectlombok lombok 1.18.2 provided - - com.fasterxml.jackson.core - jackson-annotations - ${jackson.version} - org.glassfish.jersey.ext jersey-bean-validation diff --git a/src/main/java/org/gcube/social_networking/socialnetworking/model/beans/messages/Message.java b/src/main/java/org/gcube/social_networking/socialnetworking/model/beans/messages/Message.java new file mode 100644 index 0000000..5c047c7 --- /dev/null +++ b/src/main/java/org/gcube/social_networking/socialnetworking/model/beans/messages/Message.java @@ -0,0 +1,148 @@ +package org.gcube.social_networking.socialnetworking.model.beans.messages; + +import java.util.Calendar; + +public class Message { + public Message() { + } + + String id; + + String name; + + String path; + + String parentId; + + String parentPath; + + String primaryType; + + boolean withAttachments; + + Owner sender; + + String subject; + + String body; + + boolean read; + + boolean opened; + + String[] addresses; + + Calendar creationTime; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + + public String getParentPath() { + return parentPath; + } + + public void setParentPath(String parentPath) { + this.parentPath = parentPath; + } + + public String getPrimaryType() { + return primaryType; + } + + public void setPrimaryType(String primaryType) { + this.primaryType = primaryType; + } + + public boolean isWithAttachments() { + return withAttachments; + } + + public void setWithAttachments(boolean withAttachments) { + this.withAttachments = withAttachments; + } + + public Owner getSender() { + return sender; + } + + public void setSender(Owner sender) { + this.sender = sender; + } + + 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 boolean isRead() { + return read; + } + + public void setRead(boolean read) { + this.read = read; + } + + public boolean isOpened() { + return opened; + } + + public void setOpened(boolean opened) { + this.opened = opened; + } + + public String[] getAddresses() { + return addresses; + } + + public void setAddresses(String[] addresses) { + this.addresses = addresses; + } + + public Calendar getCreationTime() { + return creationTime; + } + + public void setCreationTime(Calendar creationTime) { + this.creationTime = creationTime; + } +} diff --git a/src/main/java/org/gcube/social_networking/socialnetworking/model/beans/MessageInbox.java b/src/main/java/org/gcube/social_networking/socialnetworking/model/beans/messages/MessageInbox.java similarity index 83% rename from src/main/java/org/gcube/social_networking/socialnetworking/model/beans/MessageInbox.java rename to src/main/java/org/gcube/social_networking/socialnetworking/model/beans/messages/MessageInbox.java index 7078d5c..8cfbb38 100644 --- a/src/main/java/org/gcube/social_networking/socialnetworking/model/beans/MessageInbox.java +++ b/src/main/java/org/gcube/social_networking/socialnetworking/model/beans/messages/MessageInbox.java @@ -1,15 +1,11 @@ -package org.gcube.social_networking.socialnetworking.model.beans; +package org.gcube.social_networking.socialnetworking.model.beans.messages; import java.util.Arrays; /** * Used for serialization */ -public class MessageInbox extends org.gcube.common.storagehub.model.messages.Message { +public class MessageInbox extends Message { - //needed for serialization - public MessageInbox() { - super(); - } @Override public String toString() { diff --git a/src/main/java/org/gcube/social_networking/socialnetworking/model/beans/MessageInputBean.java b/src/main/java/org/gcube/social_networking/socialnetworking/model/beans/messages/MessageInputBean.java similarity index 96% rename from src/main/java/org/gcube/social_networking/socialnetworking/model/beans/MessageInputBean.java rename to src/main/java/org/gcube/social_networking/socialnetworking/model/beans/messages/MessageInputBean.java index 2ba4cf0..dd17106 100644 --- a/src/main/java/org/gcube/social_networking/socialnetworking/model/beans/MessageInputBean.java +++ b/src/main/java/org/gcube/social_networking/socialnetworking/model/beans/messages/MessageInputBean.java @@ -1,4 +1,4 @@ -package org.gcube.social_networking.socialnetworking.model.beans; +package org.gcube.social_networking.socialnetworking.model.beans.messages; import java.io.Serializable; import java.util.ArrayList; @@ -7,6 +7,8 @@ import javax.validation.Valid; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; +import org.gcube.social_networking.socialnetworking.model.beans.Recipient; + import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/src/main/java/org/gcube/social_networking/socialnetworking/model/beans/messages/Owner.java b/src/main/java/org/gcube/social_networking/socialnetworking/model/beans/messages/Owner.java new file mode 100644 index 0000000..28e9723 --- /dev/null +++ b/src/main/java/org/gcube/social_networking/socialnetworking/model/beans/messages/Owner.java @@ -0,0 +1,31 @@ +package org.gcube.social_networking.socialnetworking.model.beans.messages; +public class Owner { + String userName; + + String userId; + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public Owner() { + } + + public Owner(String userName, String userId) { + this.userName = userName; + this.userId = userId; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + +}