works
This commit is contained in:
parent
5e87b5acd7
commit
fe48cac2c0
|
@ -9,35 +9,45 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
@JsonIgnoreProperties(ignoreUnknown=true)
|
@JsonIgnoreProperties(ignoreUnknown=true)
|
||||||
@JsonTypeName("ITEM_NEW")
|
@JsonTypeName("ITEM_NEW")
|
||||||
public class AddedItemEvent extends WorkspaceEvent {
|
public class AddedItemEvent extends WorkspaceEvent {
|
||||||
/**
|
private static final WorkspaceEventType TYPE = WorkspaceEventType.ITEM_NEW;
|
||||||
* the username of the user you wish to notify
|
|
||||||
*/
|
|
||||||
@JsonProperty("userIdToNotify")
|
|
||||||
@NotNull(message="recipient cannot be missing")
|
|
||||||
private String userIdToNotify;
|
|
||||||
|
|
||||||
@JsonProperty("fileItem")
|
@JsonProperty("fileItem")
|
||||||
@NotNull(message="fileItem cannot be missing")
|
@NotNull(message="fileItem cannot be missing")
|
||||||
private FileItemBean item;
|
private FileItemBean item;
|
||||||
|
|
||||||
public AddedItemEvent() {
|
public AddedItemEvent() {
|
||||||
super(WorkspaceEventType.ITEM_NEW);
|
super(WorkspaceEventType.ITEM_NEW);
|
||||||
// TODO Auto-generated constructor stub
|
// TODO Auto-generated constructor stub
|
||||||
}
|
}
|
||||||
|
|
||||||
public AddedItemEvent(String userIdToNotify, FileItemBean item) {
|
|
||||||
super(WorkspaceEventType.ITEM_NEW);
|
/**
|
||||||
this.userIdToNotify = userIdToNotify;
|
*
|
||||||
|
* @param idsToNotify usernames or contexts
|
||||||
|
* @param idsAsGroup true if idsToNotify are groups (members of contexts)
|
||||||
|
* @param item
|
||||||
|
*/
|
||||||
|
public AddedItemEvent(String[] idsToNotify, boolean idsAsGroup, FileItemBean item) {
|
||||||
|
super(TYPE);
|
||||||
|
this.idsToNotify = idsToNotify;
|
||||||
|
this.idsAsGroup = idsAsGroup;
|
||||||
this.item = item;
|
this.item = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserIdToNotify() {
|
|
||||||
return userIdToNotify;
|
/**
|
||||||
|
*
|
||||||
|
* @param idsToNotify usernames
|
||||||
|
* @param item
|
||||||
|
*/
|
||||||
|
public AddedItemEvent(String[] idsToNotify, FileItemBean item) {
|
||||||
|
super(TYPE);
|
||||||
|
this.idsToNotify = idsToNotify;
|
||||||
|
this.item = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserIdToNotify(String userIdToNotify) {
|
|
||||||
this.userIdToNotify = userIdToNotify;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileItemBean getItem() {
|
public FileItemBean getItem() {
|
||||||
return item;
|
return item;
|
||||||
|
@ -47,10 +57,7 @@ public class AddedItemEvent extends WorkspaceEvent {
|
||||||
this.item = item;
|
this.item = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "AddedItemEvent [userIdToNotify=" + userIdToNotify + ", item=" + item + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,99 @@
|
||||||
|
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("FOLDER_RENAME")
|
||||||
|
public class RenamedFolderEvent extends WorkspaceEvent {
|
||||||
|
private static final WorkspaceEventType TYPE = WorkspaceEventType.FOLDER_RENAME;
|
||||||
|
|
||||||
|
@JsonProperty("previousName")
|
||||||
|
@NotNull(message="previousName cannot be missing")
|
||||||
|
private String previousName;
|
||||||
|
|
||||||
|
@JsonProperty("newName")
|
||||||
|
@NotNull(message="newName cannot be missing")
|
||||||
|
private String newName;
|
||||||
|
|
||||||
|
@JsonProperty("renamedFolderId")
|
||||||
|
@NotNull(message="renamedFolderId cannot be missing")
|
||||||
|
private String renamedFolderId;
|
||||||
|
|
||||||
|
|
||||||
|
public RenamedFolderEvent() {
|
||||||
|
super(TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param idsToNotify usernames or contexts
|
||||||
|
* @param idsAsGroup true if idsToNotify are groups (members of contexts)
|
||||||
|
* @param previousName
|
||||||
|
* @param newName
|
||||||
|
* @param renamedFolderId
|
||||||
|
*/
|
||||||
|
public RenamedFolderEvent(String[] idsToNotify, boolean idsAsGroup, String previousName, String newName, String renamedFolderId) {
|
||||||
|
super(TYPE);
|
||||||
|
this.idsToNotify = idsToNotify;
|
||||||
|
this.idsAsGroup = idsAsGroup;
|
||||||
|
this.previousName = previousName;
|
||||||
|
this.newName = newName;
|
||||||
|
this.renamedFolderId = renamedFolderId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param idsToNotify usernames
|
||||||
|
* @param previousName
|
||||||
|
* @param newName
|
||||||
|
* @param renamedFolderId
|
||||||
|
*/
|
||||||
|
public RenamedFolderEvent(String[] idsToNotify, String previousName, String newName, String renamedFolderId) {
|
||||||
|
super(TYPE);
|
||||||
|
this.idsToNotify = idsToNotify;
|
||||||
|
this.previousName = previousName;
|
||||||
|
this.newName = newName;
|
||||||
|
this.renamedFolderId = renamedFolderId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getPreviousName() {
|
||||||
|
return previousName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setPreviousName(String previousName) {
|
||||||
|
this.previousName = previousName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getNewName() {
|
||||||
|
return newName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setNewName(String newName) {
|
||||||
|
this.newName = newName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getRenamedFolderId() {
|
||||||
|
return renamedFolderId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setRenamedFolderId(String renamedFolderId) {
|
||||||
|
this.renamedFolderId = renamedFolderId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "RenamedFolderEvent [previousName=" + previousName + ", newName=" + newName + ", renamedFolderId="
|
||||||
|
+ renamedFolderId + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.gcube.social_networking.socialnetworking.model.beans.workspace;
|
package org.gcube.social_networking.socialnetworking.model.beans.workspace;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
@ -10,36 +12,38 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
@JsonIgnoreProperties(ignoreUnknown=true)
|
@JsonIgnoreProperties(ignoreUnknown=true)
|
||||||
@JsonTypeName("FOLDER_SHARE")
|
@JsonTypeName("FOLDER_SHARE")
|
||||||
public class SharedFolderEvent extends WorkspaceEvent {
|
public class SharedFolderEvent extends WorkspaceEvent {
|
||||||
|
private static final WorkspaceEventType TYPE = WorkspaceEventType.FOLDER_SHARE;
|
||||||
/**
|
|
||||||
* the username of the user you wish to notify
|
|
||||||
*/
|
|
||||||
@JsonProperty("userIdToNotify")
|
|
||||||
@NotNull(message="recipient cannot be missing")
|
|
||||||
private String userIdToNotify;
|
|
||||||
|
|
||||||
@JsonProperty("folderItem")
|
@JsonProperty("folderItem")
|
||||||
@NotNull(message="folderItem cannot be missing")
|
@NotNull(message="folderItem cannot be missing")
|
||||||
private FolderBean folder;
|
private FolderBean folder;
|
||||||
|
|
||||||
|
|
||||||
public SharedFolderEvent() {
|
public SharedFolderEvent() {
|
||||||
super(WorkspaceEventType.FOLDER_SHARE);
|
super(WorkspaceEventType.FOLDER_SHARE);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
public SharedFolderEvent(String userIdToNotify, FolderBean folder) {
|
*
|
||||||
super(WorkspaceEventType.FOLDER_SHARE);
|
* @param idsToNotify usernames
|
||||||
this.userIdToNotify = userIdToNotify;
|
* @param idsAsGroup true if idsToNotify are groups (members of contexts)
|
||||||
|
* @param FolderBean the folder
|
||||||
|
*/
|
||||||
|
public SharedFolderEvent(String[] idsToNotify, boolean idsAsGroup, String userIdToNotify, FolderBean folder) {
|
||||||
|
super(TYPE);
|
||||||
|
this.idsToNotify = idsToNotify;
|
||||||
|
this.idsAsGroup = idsAsGroup;
|
||||||
|
this.folder = folder;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param idsToNotify usernames
|
||||||
|
* @param FolderBean the folder
|
||||||
|
*/
|
||||||
|
public SharedFolderEvent(String[] idsToNotify, String userIdToNotify, FolderBean folder) {
|
||||||
|
super(TYPE);
|
||||||
|
this.idsToNotify = idsToNotify;
|
||||||
this.folder = folder;
|
this.folder = folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserIdToNotify() {
|
|
||||||
return userIdToNotify;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserIdToNotify(String userIdToNotify) {
|
|
||||||
this.userIdToNotify = userIdToNotify;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FolderBean getFolder() {
|
public FolderBean getFolder() {
|
||||||
return folder;
|
return folder;
|
||||||
|
@ -48,9 +52,11 @@ public class SharedFolderEvent extends WorkspaceEvent {
|
||||||
public void setFolder(FolderBean folder) {
|
public void setFolder(FolderBean folder) {
|
||||||
this.folder = folder;
|
this.folder = folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "SharedFolderEvent [userIdToNotify=" + userIdToNotify + ", folder=" + folder + "]";
|
return "SharedFolderEvent [folder=" + folder + ", TYPE=" + TYPE + ", idsToNotify="
|
||||||
}
|
+ Arrays.toString(idsToNotify) + ", idsAsGroup=" + idsAsGroup + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.gcube.social_networking.socialnetworking.model.beans.workspace;
|
package org.gcube.social_networking.socialnetworking.model.beans.workspace;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
@ -9,14 +11,8 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
@JsonIgnoreProperties(ignoreUnknown=true)
|
@JsonIgnoreProperties(ignoreUnknown=true)
|
||||||
@JsonTypeName("FOLDER_UNSHARE")
|
@JsonTypeName("FOLDER_UNSHARE")
|
||||||
public class UnsharedFolderEvent extends WorkspaceEvent {
|
public class UnsharedFolderEvent extends WorkspaceEvent {
|
||||||
|
|
||||||
|
|
||||||
/**
|
private static final WorkspaceEventType TYPE = WorkspaceEventType.FOLDER_UNSHARE;
|
||||||
* the username of the user you wish to notify
|
|
||||||
*/
|
|
||||||
@JsonProperty("userIdToNotify")
|
|
||||||
@NotNull(message="recipient cannot be missing")
|
|
||||||
private String userIdToNotify;
|
|
||||||
|
|
||||||
@JsonProperty("unsharedFolderId")
|
@JsonProperty("unsharedFolderId")
|
||||||
@NotNull(message="folderid cannot be missing")
|
@NotNull(message="folderid cannot be missing")
|
||||||
|
@ -28,39 +24,43 @@ public class UnsharedFolderEvent extends WorkspaceEvent {
|
||||||
|
|
||||||
|
|
||||||
public UnsharedFolderEvent() {
|
public UnsharedFolderEvent() {
|
||||||
super(WorkspaceEventType.FOLDER_UNSHARE);
|
super(TYPE);
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public UnsharedFolderEvent(String userIdToNotify, String unsharedFolderId, String unsharedFolderName) {
|
/**
|
||||||
super(WorkspaceEventType.FOLDER_UNSHARE);
|
*
|
||||||
this.userIdToNotify = userIdToNotify;
|
* @param idsToNotify usernames or contexts
|
||||||
|
* @param idsAsGroup true if idsToNotify are groups (members of contexts)
|
||||||
|
* @param unsharedFolderId
|
||||||
|
* @param unsharedFolderName
|
||||||
|
*/
|
||||||
|
public UnsharedFolderEvent(String[] idsToNotify, boolean idsAsGroup, String unsharedFolderId, String unsharedFolderName) {
|
||||||
|
super(TYPE);
|
||||||
|
this.idsToNotify = idsToNotify;
|
||||||
|
this.idsAsGroup = idsAsGroup;
|
||||||
|
this.unsharedFolderId = unsharedFolderId;
|
||||||
|
this.unsharedFolderName = unsharedFolderName;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param idsToNotify usernames
|
||||||
|
* @param unsharedFolderId
|
||||||
|
* @param unsharedFolderName
|
||||||
|
*/
|
||||||
|
public UnsharedFolderEvent(String[] idsToNotify, String unsharedFolderId, String unsharedFolderName) {
|
||||||
|
super(TYPE);
|
||||||
|
this.idsToNotify = idsToNotify;
|
||||||
this.unsharedFolderId = unsharedFolderId;
|
this.unsharedFolderId = unsharedFolderId;
|
||||||
this.unsharedFolderName = unsharedFolderName;
|
this.unsharedFolderName = unsharedFolderName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "UnsharedFolderEvent [userIdToNotify=" + userIdToNotify + ", unsharedFolderId="
|
|
||||||
+ unsharedFolderId + ", unsharedFolderName=" + unsharedFolderName + ", Type=" + TYPE + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUserIdToNotify() {
|
|
||||||
return userIdToNotify;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserIdToNotify(String userIdToNotify) {
|
|
||||||
this.userIdToNotify = userIdToNotify;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUnsharedFolderId() {
|
public String getUnsharedFolderId() {
|
||||||
return unsharedFolderId;
|
return unsharedFolderId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setUnsharedFolderId(String unsharedFolderId) {
|
public void setUnsharedFolderId(String unsharedFolderId) {
|
||||||
this.unsharedFolderId = unsharedFolderId;
|
this.unsharedFolderId = unsharedFolderId;
|
||||||
}
|
}
|
||||||
|
@ -72,5 +72,15 @@ public class UnsharedFolderEvent extends WorkspaceEvent {
|
||||||
public void setUnsharedFolderName(String unsharedFolderName) {
|
public void setUnsharedFolderName(String unsharedFolderName) {
|
||||||
this.unsharedFolderName = unsharedFolderName;
|
this.unsharedFolderName = unsharedFolderName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "UnsharedFolderEvent [unsharedFolderId=" + unsharedFolderId + ", unsharedFolderName="
|
||||||
|
+ unsharedFolderName + ", TYPE=" + TYPE + ", idsToNotify=" + Arrays.toString(idsToNotify)
|
||||||
|
+ ", idsAsGroup=" + idsAsGroup + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package org.gcube.social_networking.socialnetworking.model.beans.workspace;
|
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.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;
|
||||||
|
@ -13,16 +16,59 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
|
||||||
include = As.PROPERTY, property = "type") @JsonSubTypes({
|
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 = AddedItemEvent.class, name = "ITEM_NEW")
|
@JsonSubTypes.Type(value = AddedItemEvent.class, name = "ITEM_NEW")
|
||||||
})
|
})
|
||||||
public abstract class WorkspaceEvent {
|
public abstract class WorkspaceEvent {
|
||||||
protected final WorkspaceEventType TYPE;
|
protected final WorkspaceEventType TYPE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the username of the user you wish to notify
|
||||||
|
*/
|
||||||
|
@JsonProperty("idsToNotify")
|
||||||
|
@NotNull(message="recipients cannot be missing, use usernames or contexts")
|
||||||
|
protected String[] idsToNotify;
|
||||||
|
protected boolean idsAsGroup = false;
|
||||||
|
|
||||||
WorkspaceEvent(WorkspaceEventType TYPE) {
|
WorkspaceEvent(WorkspaceEventType TYPE) {
|
||||||
this.TYPE = TYPE;
|
this.TYPE = TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param tYPE
|
||||||
|
* @param idsToNotify usernames or contexts
|
||||||
|
* @param idsAsGroup true whether the idsToNotify have to be interpreted as groups and not usernames, false is default
|
||||||
|
*/
|
||||||
|
WorkspaceEvent(WorkspaceEventType tYPE, String[] idsToNotify, boolean idsAsGroup) {
|
||||||
|
super();
|
||||||
|
TYPE = tYPE;
|
||||||
|
this.idsToNotify = idsToNotify;
|
||||||
|
this.idsAsGroup = idsAsGroup;
|
||||||
|
}
|
||||||
public WorkspaceEventType getType() {
|
public WorkspaceEventType getType() {
|
||||||
return TYPE;
|
return TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String[] getIdsToNotify() {
|
||||||
|
return idsToNotify;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdsToNotify(String[] idsToNotify) {
|
||||||
|
this.idsToNotify = idsToNotify;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return true whether the idsToNotify have to be interpreted as groups and not usernames
|
||||||
|
*/
|
||||||
|
public boolean idsAsGroup() {
|
||||||
|
return idsAsGroup;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param idsAsGroup set true whether the idsToNotify have to be interpreted as groups and not usernames, false otherwise
|
||||||
|
*/
|
||||||
|
public void setIdsAsGroup(boolean idsAsGroup) {
|
||||||
|
this.idsAsGroup = idsAsGroup;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,11 @@ public enum WorkspaceEventType {
|
||||||
/**
|
/**
|
||||||
* use to notify a user he got a workspace folder Unshared
|
* use to notify a user he got a workspace folder Unshared
|
||||||
*/
|
*/
|
||||||
FOLDER_UNSHARE(UnsharedFolderEvent.class);
|
FOLDER_UNSHARE(UnsharedFolderEvent.class),
|
||||||
|
/**
|
||||||
|
* use to notify a user he got a workspace folder renamed
|
||||||
|
*/
|
||||||
|
FOLDER_RENAME(RenamedFolderEvent.class);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue