many events added
This commit is contained in:
parent
5a581fc5e5
commit
472dbe096c
|
@ -1,5 +1,7 @@
|
|||
package org.gcube.social_networking.socialnetworking.model.beans.workspace;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
@ -57,6 +59,10 @@ public class AddedItemEvent extends WorkspaceEvent {
|
|||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AddedItemEvent [item=" + item + ", TYPE=" + TYPE + ", idsToNotify=" + Arrays.toString(idsToNotify)
|
||||
+ ", idsAsGroup=" + idsAsGroup + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.gcube.social_networking.socialnetworking.model.beans.workspace;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
@ -11,53 +13,71 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
|||
public class DeletedItemEvent extends WorkspaceEvent {
|
||||
private static final WorkspaceEventType TYPE = WorkspaceEventType.ITEM_DELETE;
|
||||
|
||||
@JsonProperty("itemName")
|
||||
@NotNull
|
||||
private String itemName;
|
||||
|
||||
@JsonProperty("fileItem")
|
||||
@NotNull(message="fileItem cannot be missing")
|
||||
private FileItemBean item;
|
||||
@JsonProperty("folderItem")
|
||||
@NotNull(message="folderItem cannot be missing")
|
||||
private FolderBean folder;
|
||||
|
||||
public DeletedItemEvent() {
|
||||
super(TYPE);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param idsToNotify usernames or contexts
|
||||
* @param idsAsGroup true if idsToNotify are groups (members of contexts)
|
||||
* @param item
|
||||
* @param itemName the deleted item name
|
||||
* @param FolderBean the folder
|
||||
*/
|
||||
public DeletedItemEvent(String[] idsToNotify, boolean idsAsGroup, FileItemBean item) {
|
||||
public DeletedItemEvent(String[] idsToNotify, boolean idsAsGroup, String itemName, FolderBean folder) {
|
||||
super(TYPE);
|
||||
this.idsToNotify = idsToNotify;
|
||||
this.idsAsGroup = idsAsGroup;
|
||||
this.item = item;
|
||||
this.itemName = itemName;
|
||||
this.folder = folder;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param idsToNotify usernames
|
||||
* @param item
|
||||
* @param itemName the deleted item name
|
||||
* @param FolderBean the folder
|
||||
*/
|
||||
public DeletedItemEvent(String[] idsToNotify, FileItemBean item) {
|
||||
public DeletedItemEvent(String[] idsToNotify, String itemName, FolderBean folder) {
|
||||
super(TYPE);
|
||||
this.idsToNotify = idsToNotify;
|
||||
this.item = item;
|
||||
this.itemName = itemName;
|
||||
this.folder = folder;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public FileItemBean getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public void setItem(FileItemBean item) {
|
||||
this.item = item;
|
||||
public String getItemName() {
|
||||
return itemName;
|
||||
}
|
||||
|
||||
|
||||
public void setItemName(String itemName) {
|
||||
this.itemName = itemName;
|
||||
}
|
||||
|
||||
|
||||
public FolderBean getFolder() {
|
||||
return folder;
|
||||
}
|
||||
|
||||
|
||||
public void setFolder(FolderBean folder) {
|
||||
this.folder = folder;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DeletedItemEvent [itemName=" + itemName + ", folder=" + folder + ", TYPE=" + TYPE + ", idsToNotify="
|
||||
+ Arrays.toString(idsToNotify) + ", idsAsGroup=" + idsAsGroup + "]";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
package org.gcube.social_networking.socialnetworking.model.beans.workspace;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown=true)
|
||||
@JsonTypeName("ITEM_UPDATE")
|
||||
public class UpdatedItemEvent extends WorkspaceEvent {
|
||||
private static final WorkspaceEventType TYPE = WorkspaceEventType.ITEM_UPDATE;
|
||||
|
||||
|
||||
@JsonProperty("fileItem")
|
||||
@NotNull(message="fileItem cannot be missing")
|
||||
private FileItemBean item;
|
||||
|
||||
public UpdatedItemEvent() {
|
||||
super(TYPE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param idsToNotify usernames or contexts
|
||||
* @param idsAsGroup true if idsToNotify are groups (members of contexts)
|
||||
* @param item
|
||||
*/
|
||||
public UpdatedItemEvent(String[] idsToNotify, boolean idsAsGroup, FileItemBean item) {
|
||||
super(TYPE);
|
||||
this.idsToNotify = idsToNotify;
|
||||
this.idsAsGroup = idsAsGroup;
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param idsToNotify usernames
|
||||
* @param item
|
||||
*/
|
||||
public UpdatedItemEvent(String[] idsToNotify, FileItemBean item) {
|
||||
super(TYPE);
|
||||
this.idsToNotify = idsToNotify;
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public FileItemBean getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public void setItem(FileItemBean item) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UpdatedItemEvent [item=" + item + ", TYPE=" + TYPE + ", idsToNotify=" + Arrays.toString(idsToNotify)
|
||||
+ ", idsAsGroup=" + idsAsGroup + "]";
|
||||
}
|
||||
}
|
|
@ -19,6 +19,7 @@ include = As.PROPERTY, property = "type") @JsonSubTypes({
|
|||
@JsonSubTypes.Type(value = UnsharedFolderEvent.class, name = "FOLDER_UNSHARE"),
|
||||
@JsonSubTypes.Type(value = RenamedFolderEvent.class, name = "FOLDER_RENAME"),
|
||||
@JsonSubTypes.Type(value = AddedItemEvent.class, name = "ITEM_NEW"),
|
||||
@JsonSubTypes.Type(value = UpdatedItemEvent.class, name = "ITEM_UPDATE"),
|
||||
@JsonSubTypes.Type(value = DeletedItemEvent.class, name = "ITEM_DELETE"),
|
||||
@JsonSubTypes.Type(value = FolderAddedUserEvent.class, name = "FOLDER_ADDEDUSER"),
|
||||
@JsonSubTypes.Type(value = FolderRemovedUserEvent.class, name = "FOLDER_REMOVEDUSER")
|
||||
|
|
|
@ -10,6 +10,10 @@ public enum WorkspaceEventType {
|
|||
* use to notify a user she got a workspace item deleted from one of his workspace shared folder
|
||||
*/
|
||||
ITEM_DELETE(DeletedItemEvent.class),
|
||||
/**
|
||||
* use to notify a user he got a workspace item updated from one of his workspace shared folder
|
||||
*/
|
||||
ITEM_UPDATE(UpdatedItemEvent.class),
|
||||
/**
|
||||
* use to notify a user he got a workspace folder shared
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue