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; package org.gcube.social_networking.socialnetworking.model.beans;
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeInfo.As; 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") @JsonSubTypes.Type(value = WorkspaceNotificationAddedItem.class, name = "ITEM_NEW")
}) })
public abstract class WorkspaceNotification { public abstract class WorkspaceNotification {
WorkspaceNotificationType type; protected final WorkspaceNotificationType TYPE;
public WorkspaceNotificationType getType() { WorkspaceNotification(WorkspaceNotificationType TYPE) {
return type; this.TYPE = TYPE;
} }
public WorkspaceNotificationType TYPE() {
return TYPE;
}
} }

View File

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

View File

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

View File

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