This commit is contained in:
parent
472dbe096c
commit
27942f89bb
|
@ -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_ADMIN_DOWNGRADE")
|
||||||
|
public class FolderAdminDowngradeEvent extends WorkspaceEvent {
|
||||||
|
private static final WorkspaceEventType TYPE = WorkspaceEventType.FOLDER_ADMIN_DOWNGRADE;
|
||||||
|
@JsonProperty("folderItem")
|
||||||
|
@NotNull(message="folderItem cannot be missing")
|
||||||
|
private FolderBean folder;
|
||||||
|
|
||||||
|
public FolderAdminDowngradeEvent() {
|
||||||
|
super(TYPE);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param idsToNotify usernames
|
||||||
|
* @param idsAsGroup true if idsToNotify are groups (members of contexts)
|
||||||
|
* @param FolderBean the folder
|
||||||
|
*/
|
||||||
|
public FolderAdminDowngradeEvent(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 FolderAdminDowngradeEvent(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 "FOLDER_ADMIN_DOWNGRADE [folder=" + folder + ", 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_ADMIN_UPGRADE")
|
||||||
|
public class FolderAdminUpgradeEvent extends WorkspaceEvent {
|
||||||
|
private static final WorkspaceEventType TYPE = WorkspaceEventType.FOLDER_ADMIN_UPGRADE;
|
||||||
|
@JsonProperty("folderItem")
|
||||||
|
@NotNull(message="folderItem cannot be missing")
|
||||||
|
private FolderBean folder;
|
||||||
|
|
||||||
|
public FolderAdminUpgradeEvent() {
|
||||||
|
super(TYPE);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param idsToNotify usernames
|
||||||
|
* @param idsAsGroup true if idsToNotify are groups (members of contexts)
|
||||||
|
* @param FolderBean the folder
|
||||||
|
*/
|
||||||
|
public FolderAdminUpgradeEvent(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 FolderAdminUpgradeEvent(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 "FolderAdminUpgradeEvent [folder=" + folder + ", TYPE=" + TYPE + ", idsToNotify="
|
||||||
|
+ Arrays.toString(idsToNotify) + ", idsAsGroup=" + idsAsGroup + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -22,7 +22,9 @@ include = As.PROPERTY, property = "type") @JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = UpdatedItemEvent.class, name = "ITEM_UPDATE"),
|
@JsonSubTypes.Type(value = UpdatedItemEvent.class, name = "ITEM_UPDATE"),
|
||||||
@JsonSubTypes.Type(value = DeletedItemEvent.class, name = "ITEM_DELETE"),
|
@JsonSubTypes.Type(value = DeletedItemEvent.class, name = "ITEM_DELETE"),
|
||||||
@JsonSubTypes.Type(value = FolderAddedUserEvent.class, name = "FOLDER_ADDEDUSER"),
|
@JsonSubTypes.Type(value = FolderAddedUserEvent.class, name = "FOLDER_ADDEDUSER"),
|
||||||
@JsonSubTypes.Type(value = FolderRemovedUserEvent.class, name = "FOLDER_REMOVEDUSER")
|
@JsonSubTypes.Type(value = FolderRemovedUserEvent.class, name = "FOLDER_REMOVEDUSER"),
|
||||||
|
@JsonSubTypes.Type(value = FolderAdminUpgradeEvent.class, name = "FOLDER_ADMIN_UPGRADE"),
|
||||||
|
@JsonSubTypes.Type(value = FolderAdminDowngradeEvent.class, name = "FOLDER_ADMIN_DOWNGRADE")
|
||||||
})
|
})
|
||||||
public abstract class WorkspaceEvent {
|
public abstract class WorkspaceEvent {
|
||||||
protected final WorkspaceEventType TYPE;
|
protected final WorkspaceEventType TYPE;
|
||||||
|
|
|
@ -26,15 +26,25 @@ public enum WorkspaceEventType {
|
||||||
* use to notify a workspace folder renamed
|
* use to notify a workspace folder renamed
|
||||||
*/
|
*/
|
||||||
FOLDER_RENAME(RenamedFolderEvent.class),
|
FOLDER_RENAME(RenamedFolderEvent.class),
|
||||||
|
/**
|
||||||
|
* use to notify a user that he got upgraded to administrator of a shared folder
|
||||||
|
*/
|
||||||
|
FOLDER_ADMIN_UPGRADE(FolderAdminUpgradeEvent.class),
|
||||||
|
/**
|
||||||
|
* use to notify a user that he got downgraded from being administrator of a shared folder
|
||||||
|
*/
|
||||||
|
FOLDER_ADMIN_DOWNGRADE(FolderAdminDowngradeEvent.class),
|
||||||
/**
|
/**
|
||||||
* use to notify that new user(s) were added in on of his workspace shared folder
|
* use to notify that new user(s) were added in on of his workspace shared folder
|
||||||
*/
|
*/
|
||||||
FOLDER_ADDEDUSER(FolderAddedUserEvent.class),
|
FOLDER_ADDEDUSER(FolderAddedUserEvent.class),
|
||||||
/**
|
/**
|
||||||
* use to notify user(s) that existing user(s) were removed from one of her workspace shared folder
|
* use to notify user(s) that they were removed from a workspace shared folder
|
||||||
*/
|
*/
|
||||||
FOLDER_REMOVEDUSER(FolderRemovedUserEvent.class);
|
FOLDER_REMOVEDUSER(FolderRemovedUserEvent.class);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Class<? extends WorkspaceEvent> beanClass;
|
Class<? extends WorkspaceEvent> beanClass;
|
||||||
|
|
Loading…
Reference in New Issue