added things
This commit is contained in:
parent
65365e8569
commit
5a581fc5e5
|
@ -17,8 +17,7 @@ public class AddedItemEvent extends WorkspaceEvent {
|
||||||
private FileItemBean item;
|
private FileItemBean item;
|
||||||
|
|
||||||
public AddedItemEvent() {
|
public AddedItemEvent() {
|
||||||
super(WorkspaceEventType.ITEM_NEW);
|
super(TYPE);
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
package org.gcube.social_networking.socialnetworking.model.beans.workspace;
|
||||||
|
|
||||||
|
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_DELETE")
|
||||||
|
public class DeletedItemEvent extends WorkspaceEvent {
|
||||||
|
private static final WorkspaceEventType TYPE = WorkspaceEventType.ITEM_DELETE;
|
||||||
|
|
||||||
|
|
||||||
|
@JsonProperty("fileItem")
|
||||||
|
@NotNull(message="fileItem cannot be missing")
|
||||||
|
private FileItemBean item;
|
||||||
|
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
public DeletedItemEvent(String[] idsToNotify, boolean idsAsGroup, FileItemBean item) {
|
||||||
|
super(TYPE);
|
||||||
|
this.idsToNotify = idsToNotify;
|
||||||
|
this.idsAsGroup = idsAsGroup;
|
||||||
|
this.item = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param idsToNotify usernames
|
||||||
|
* @param item
|
||||||
|
*/
|
||||||
|
public DeletedItemEvent(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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
package org.gcube.social_networking.socialnetworking.model.beans.workspace;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
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("FOLDER_ADDEDUSER")
|
||||||
|
public class FolderAddedUserEvent extends WorkspaceEvent {
|
||||||
|
private static final WorkspaceEventType TYPE = WorkspaceEventType.FOLDER_ADDEDUSER;
|
||||||
|
@JsonProperty("folderItem")
|
||||||
|
@NotNull(message="folderItem cannot be missing")
|
||||||
|
private FolderBean folder;
|
||||||
|
|
||||||
|
@JsonProperty("newAddedUserIds")
|
||||||
|
@NotNull(message="newAddedUserIds cannot be missing")
|
||||||
|
private List<String> newAddedUserIds;
|
||||||
|
|
||||||
|
public FolderAddedUserEvent() {
|
||||||
|
super(TYPE);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param idsToNotify usernames
|
||||||
|
* @param idsAsGroup true if idsToNotify are groups (members of contexts)
|
||||||
|
* @param FolderBean the folder
|
||||||
|
* @param newAddedUserIds list of usernames
|
||||||
|
*/
|
||||||
|
public FolderAddedUserEvent(String[] idsToNotify, boolean idsAsGroup, FolderBean folder, List<String> newAddedUserIds) {
|
||||||
|
super(TYPE);
|
||||||
|
this.idsToNotify = idsToNotify;
|
||||||
|
this.idsAsGroup = idsAsGroup;
|
||||||
|
this.newAddedUserIds = newAddedUserIds;
|
||||||
|
this.folder = folder;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param idsToNotify usernames
|
||||||
|
* @param FolderBean the folder
|
||||||
|
*/
|
||||||
|
public FolderAddedUserEvent(String[] idsToNotify, FolderBean folder, List<String> newAddedUserIds) {
|
||||||
|
super(TYPE);
|
||||||
|
this.idsToNotify = idsToNotify;
|
||||||
|
this.newAddedUserIds = newAddedUserIds;
|
||||||
|
this.folder = folder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FolderBean getFolder() {
|
||||||
|
return folder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFolder(FolderBean folder) {
|
||||||
|
this.folder = folder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getNewAddedUserIds() {
|
||||||
|
return newAddedUserIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewAddedUserIds(List<String> newAddedUserIds) {
|
||||||
|
this.newAddedUserIds = newAddedUserIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "FolderAddedUserEvent [folder=" + folder + ", newAddedUserIds=" + newAddedUserIds + ", TYPE=" + TYPE
|
||||||
|
+ ", idsToNotify=" + Arrays.toString(idsToNotify) + ", idsAsGroup=" + idsAsGroup + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
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("FOLDER_REMOVEDUSER")
|
||||||
|
public class FolderRemovedUserEvent extends WorkspaceEvent {
|
||||||
|
private static final WorkspaceEventType TYPE = WorkspaceEventType.FOLDER_REMOVEDUSER;
|
||||||
|
@JsonProperty("folderItem")
|
||||||
|
@NotNull(message="folderItem cannot be missing")
|
||||||
|
private FolderBean folder;
|
||||||
|
|
||||||
|
public FolderRemovedUserEvent() {
|
||||||
|
super(TYPE);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param idsToNotify usernames
|
||||||
|
* @param idsAsGroup true if idsToNotify are groups (members of contexts)
|
||||||
|
* @param FolderBean the folder
|
||||||
|
*/
|
||||||
|
public FolderRemovedUserEvent(String[] idsToNotify, boolean idsAsGroup, FolderBean folder) {
|
||||||
|
super(TYPE);
|
||||||
|
this.idsToNotify = idsToNotify;
|
||||||
|
this.idsAsGroup = idsAsGroup;
|
||||||
|
this.folder = folder;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param idsToNotify usernames
|
||||||
|
* @param FolderBean the folder
|
||||||
|
*/
|
||||||
|
public FolderRemovedUserEvent(String[] idsToNotify, FolderBean folder) {
|
||||||
|
super(TYPE);
|
||||||
|
this.idsToNotify = idsToNotify;
|
||||||
|
this.folder = folder;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public FolderBean getFolder() {
|
||||||
|
return folder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFolder(FolderBean folder) {
|
||||||
|
this.folder = folder;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "FolderRemovedUserEvent [folder=" + folder + ", TYPE=" + TYPE + ", idsToNotify="
|
||||||
|
+ Arrays.toString(idsToNotify) + ", idsAsGroup=" + idsAsGroup + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -18,7 +18,7 @@ public class SharedFolderEvent extends WorkspaceEvent {
|
||||||
private FolderBean folder;
|
private FolderBean folder;
|
||||||
|
|
||||||
public SharedFolderEvent() {
|
public SharedFolderEvent() {
|
||||||
super(WorkspaceEventType.FOLDER_SHARE);
|
super(TYPE);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -26,7 +26,7 @@ public class SharedFolderEvent extends WorkspaceEvent {
|
||||||
* @param idsAsGroup true if idsToNotify are groups (members of contexts)
|
* @param idsAsGroup true if idsToNotify are groups (members of contexts)
|
||||||
* @param FolderBean the folder
|
* @param FolderBean the folder
|
||||||
*/
|
*/
|
||||||
public SharedFolderEvent(String[] idsToNotify, boolean idsAsGroup, String userIdToNotify, FolderBean folder) {
|
public SharedFolderEvent(String[] idsToNotify, boolean idsAsGroup, FolderBean folder) {
|
||||||
super(TYPE);
|
super(TYPE);
|
||||||
this.idsToNotify = idsToNotify;
|
this.idsToNotify = idsToNotify;
|
||||||
this.idsAsGroup = idsAsGroup;
|
this.idsAsGroup = idsAsGroup;
|
||||||
|
@ -37,7 +37,7 @@ public class SharedFolderEvent extends WorkspaceEvent {
|
||||||
* @param idsToNotify usernames
|
* @param idsToNotify usernames
|
||||||
* @param FolderBean the folder
|
* @param FolderBean the folder
|
||||||
*/
|
*/
|
||||||
public SharedFolderEvent(String[] idsToNotify, String userIdToNotify, FolderBean folder) {
|
public SharedFolderEvent(String[] idsToNotify, FolderBean folder) {
|
||||||
super(TYPE);
|
super(TYPE);
|
||||||
this.idsToNotify = idsToNotify;
|
this.idsToNotify = idsToNotify;
|
||||||
this.folder = folder;
|
this.folder = folder;
|
||||||
|
|
|
@ -18,7 +18,10 @@ include = As.PROPERTY, property = "type") @JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = SharedFolderEvent.class, name = "FOLDER_SHARE"),
|
@JsonSubTypes.Type(value = SharedFolderEvent.class, name = "FOLDER_SHARE"),
|
||||||
@JsonSubTypes.Type(value = UnsharedFolderEvent.class, name = "FOLDER_UNSHARE"),
|
@JsonSubTypes.Type(value = UnsharedFolderEvent.class, name = "FOLDER_UNSHARE"),
|
||||||
@JsonSubTypes.Type(value = RenamedFolderEvent.class, name = "FOLDER_RENAME"),
|
@JsonSubTypes.Type(value = RenamedFolderEvent.class, name = "FOLDER_RENAME"),
|
||||||
@JsonSubTypes.Type(value = AddedItemEvent.class, name = "ITEM_NEW")
|
@JsonSubTypes.Type(value = AddedItemEvent.class, name = "ITEM_NEW"),
|
||||||
|
@JsonSubTypes.Type(value = DeletedItemEvent.class, name = "ITEM_DELETE"),
|
||||||
|
@JsonSubTypes.Type(value = FolderAddedUserEvent.class, name = "FOLDER_ADDEDUSER"),
|
||||||
|
@JsonSubTypes.Type(value = FolderRemovedUserEvent.class, name = "FOLDER_REMOVEDUSER")
|
||||||
})
|
})
|
||||||
public abstract class WorkspaceEvent {
|
public abstract class WorkspaceEvent {
|
||||||
protected final WorkspaceEventType TYPE;
|
protected final WorkspaceEventType TYPE;
|
||||||
|
@ -31,12 +34,16 @@ public abstract class WorkspaceEvent {
|
||||||
protected String[] idsToNotify;
|
protected String[] idsToNotify;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @documentationExample false, optionl field, set to true if the idsToNotify are contexts, default is false
|
* optionl field, set to true if the idsToNotify are contexts, default is false
|
||||||
*/
|
*/
|
||||||
@JsonProperty("idsAsGroup")
|
@JsonProperty("idsAsGroup")
|
||||||
@DefaultValue("false")
|
@DefaultValue("false")
|
||||||
protected boolean idsAsGroup = false;
|
protected boolean idsAsGroup = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @documentationExample FOLDER_SHARE
|
||||||
|
* @param TYPE
|
||||||
|
*/
|
||||||
WorkspaceEvent(WorkspaceEventType TYPE) {
|
WorkspaceEvent(WorkspaceEventType TYPE) {
|
||||||
this.TYPE = TYPE;
|
this.TYPE = TYPE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,18 +6,30 @@ public enum WorkspaceEventType {
|
||||||
* use to notify a user she got a workspace item new in some of her workspace shared folder
|
* use to notify a user she got a workspace item new in some of her workspace shared folder
|
||||||
*/
|
*/
|
||||||
ITEM_NEW(AddedItemEvent.class),
|
ITEM_NEW(AddedItemEvent.class),
|
||||||
|
/**
|
||||||
|
* 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 folder shared
|
* use to notify a user he got a workspace folder shared
|
||||||
*/
|
*/
|
||||||
FOLDER_SHARE(SharedFolderEvent.class),
|
FOLDER_SHARE(SharedFolderEvent.class),
|
||||||
/**
|
/**
|
||||||
* use to notify a user he got a workspace folder Unshared
|
* use to notify a workspace folder Unshared
|
||||||
*/
|
*/
|
||||||
FOLDER_UNSHARE(UnsharedFolderEvent.class),
|
FOLDER_UNSHARE(UnsharedFolderEvent.class),
|
||||||
/**
|
/**
|
||||||
* use to notify a user he got a workspace folder renamed
|
* use to notify a workspace folder renamed
|
||||||
*/
|
*/
|
||||||
FOLDER_RENAME(RenamedFolderEvent.class);
|
FOLDER_RENAME(RenamedFolderEvent.class),
|
||||||
|
/**
|
||||||
|
* use to notify that new user(s) were added in on of his workspace shared folder
|
||||||
|
*/
|
||||||
|
FOLDER_ADDEDUSER(FolderAddedUserEvent.class),
|
||||||
|
/**
|
||||||
|
* use to notify user(s) that existing user(s) were removed from one of her workspace shared folder
|
||||||
|
*/
|
||||||
|
FOLDER_REMOVEDUSER(FolderRemovedUserEvent.class);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue