first notifications working

This commit is contained in:
Massimiliano Assante 2022-04-29 14:52:03 +02:00
parent 593644b9ec
commit 2fcbb24d63
6 changed files with 56 additions and 7 deletions

View File

@ -20,6 +20,7 @@
<properties>
<java-version>1.8</java-version>
<version.jersey>2.9</version.jersey>
<jackson.version>2.8.11</jackson.version>
<enunciate.version>2.14.0</enunciate.version>
<gCubeSubsystem>social-networking</gCubeSubsystem>
<distroDirectory>${project.basedir}/distro</distroDirectory>
@ -54,12 +55,16 @@
</scm>
<dependencies>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>storagehub-model</artifactId>
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-bean-validation</artifactId>

View File

@ -2,9 +2,13 @@ package org.gcube.social_networking.socialnetworking.model.beans;
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
public class WSAddedItemNotificationBean implements WorkspaceNotificationBean {
@JsonTypeName("ITEM_NEW")
@JsonIgnoreProperties(ignoreUnknown=true)
public class WSAddedItemNotificationBean extends WorkspaceNotificationBean {
/**
* the username of the user you wish to notify
*/
@ -19,6 +23,11 @@ public class WSAddedItemNotificationBean implements WorkspaceNotificationBean {
@JsonProperty("folderItem")
@NotNull(message="folderItem cannot be missing")
private SharedFolderBean folder;
public WSAddedItemNotificationBean() {
super();
// TODO Auto-generated constructor stub
}
public WSAddedItemNotificationBean(String userIdToNotify, WorkspaceFileItemBean item, SharedFolderBean folder) {
super();

View File

@ -2,9 +2,14 @@ package org.gcube.social_networking.socialnetworking.model.beans;
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
public class WSSharedFolderNotificationBean implements WorkspaceNotificationBean {
@JsonTypeName("FOLDER_SHARE")
@JsonIgnoreProperties(ignoreUnknown=true)
public class WSSharedFolderNotificationBean extends WorkspaceNotificationBean {
/**
* the username of the user you wish to notify

View File

@ -2,9 +2,12 @@ package org.gcube.social_networking.socialnetworking.model.beans;
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
public class WSUnsharedFolderNotificationBean implements WorkspaceNotificationBean {
@JsonTypeName("FOLDER_UNSHARE")
public class WSUnsharedFolderNotificationBean extends WorkspaceNotificationBean {
/**
* the username of the user you wish to notify
@ -19,7 +22,13 @@ public class WSUnsharedFolderNotificationBean implements WorkspaceNotificationBe
@JsonProperty("unsharedFolderName")
@NotNull(message="unsharedFolderName cannot be missing")
private String unsharedFolderName;
private String unsharedFolderName;
public WSUnsharedFolderNotificationBean() {
super();
// TODO Auto-generated constructor stub
}
public WSUnsharedFolderNotificationBean(String userIdToNotify, String unsharedFolderId, String unsharedFolderName) {
super();

View File

@ -1,5 +1,17 @@
package org.gcube.social_networking.socialnetworking.model.beans;
public interface WorkspaceNotificationBean {
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME,
include = As.PROPERTY, property = "type") @JsonSubTypes({
@JsonSubTypes.Type(value = WSSharedFolderNotificationBean.class, name = "FOLDER_SHARE"),
@JsonSubTypes.Type(value = WSUnsharedFolderNotificationBean.class, name = "FOLDER_UNSHARE"),
@JsonSubTypes.Type(value = WSAddedItemNotificationBean.class, name = "ITEM_NEW")
})
public abstract class WorkspaceNotificationBean {
}

View File

@ -5,6 +5,10 @@ public class WorkspaceNotificationMessage {
private WorkspaceNotificationType type;
private WorkspaceNotificationBean bean;
public WorkspaceNotificationMessage() {
super();
}
public WorkspaceNotificationMessage(WorkspaceNotificationType type, WorkspaceNotificationBean bean) {
super();
@ -20,6 +24,11 @@ public class WorkspaceNotificationMessage {
return bean;
}
public void setType(WorkspaceNotificationType type) {
this.type = type;
}
public void setBean(WorkspaceNotificationBean bean) {
this.bean = bean;
}
}