fixed bug

This commit is contained in:
Massimiliano Assante 2022-05-03 16:42:30 +02:00
parent e4f320f39c
commit 9f77b168aa
4 changed files with 27 additions and 14 deletions

View File

@ -1,6 +1,9 @@
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.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
@ -16,11 +19,13 @@ include = As.PROPERTY, property = "type") @JsonSubTypes({
@JsonSubTypes.Type(value = WorkspaceNotificationAddedItem.class, name = "ITEM_NEW")
})
public abstract class WorkspaceNotification {
WorkspaceNotificationType type;
public WorkspaceNotificationType getType() {
return type;
protected final WorkspaceNotificationType TYPE;
WorkspaceNotification(WorkspaceNotificationType TYPE) {
this.TYPE = TYPE;
}
public WorkspaceNotificationType TYPE() {
return TYPE;
}
}

View File

@ -25,16 +25,15 @@ public class WorkspaceNotificationAddedItem extends WorkspaceNotification {
private WorkspaceFolderBean folder;
public WorkspaceNotificationAddedItem() {
super();
super(WorkspaceNotificationType.ITEM_NEW);
// TODO Auto-generated constructor stub
}
public WorkspaceNotificationAddedItem(String userIdToNotify, WorkspaceFileItemBean item, WorkspaceFolderBean folder) {
super();
super(WorkspaceNotificationType.ITEM_NEW);
this.userIdToNotify = userIdToNotify;
this.item = item;
this.folder = folder;
this.type = WorkspaceNotificationType.ITEM_NEW;
}
public String getUserIdToNotify() {

View File

@ -21,12 +21,16 @@ public class WorkspaceNotificationSharedFolder extends WorkspaceNotification {
@JsonProperty("folderItem")
@NotNull(message="folderItem cannot be missing")
private WorkspaceFolderBean folder;
public WorkspaceNotificationSharedFolder(WorkspaceNotificationType TYPE) {
super(WorkspaceNotificationType.FOLDER_SHARE);
}
public WorkspaceNotificationSharedFolder(String userIdToNotify, WorkspaceFolderBean folder) {
super();
super(WorkspaceNotificationType.FOLDER_SHARE);
this.userIdToNotify = userIdToNotify;
this.folder = folder;
this.type = WorkspaceNotificationType.FOLDER_SHARE;
}
public String getUserIdToNotify() {

View File

@ -9,6 +9,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
@JsonIgnoreProperties(ignoreUnknown=true)
@JsonTypeName("UNSHARED_FOLDER")
public class WorkspaceNotificationUnsharedFolder extends WorkspaceNotification {
/**
* the username of the user you wish to notify
@ -24,25 +25,29 @@ public class WorkspaceNotificationUnsharedFolder extends WorkspaceNotification {
@JsonProperty("unsharedFolderName")
@NotNull(message="unsharedFolderName cannot be missing")
private String unsharedFolderName;
public WorkspaceNotificationUnsharedFolder() {
super();
super(WorkspaceNotificationType.FOLDER_UNSHARE);
// TODO Auto-generated constructor stub
}
public WorkspaceNotificationUnsharedFolder(String userIdToNotify, String unsharedFolderId, String unsharedFolderName) {
super();
super(WorkspaceNotificationType.FOLDER_UNSHARE);
this.userIdToNotify = userIdToNotify;
this.unsharedFolderId = unsharedFolderId;
this.unsharedFolderName = unsharedFolderName;
this.type = WorkspaceNotificationType.FOLDER_UNSHARE;
}
@Override
public String toString() {
return "WorkspaceNotificationUnsharedFolder [userIdToNotify=" + userIdToNotify + ", unsharedFolderId="
+ unsharedFolderId + ", unsharedFolderName=" + unsharedFolderName + "]";
+ unsharedFolderId + ", unsharedFolderName=" + unsharedFolderName + ", Type=" + TYPE + "]";
}
public String getUserIdToNotify() {