2022-05-04 11:26:41 +02:00
|
|
|
package org.gcube.social_networking.socialnetworking.model.beans.workspace;
|
|
|
|
|
2022-05-04 16:35:59 +02:00
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
|
|
2022-05-04 11:26:41 +02:00
|
|
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
2022-05-04 16:35:59 +02:00
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
2022-05-04 11:26:41 +02:00
|
|
|
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The WorkspaceEvent super class
|
|
|
|
*/
|
|
|
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
|
|
|
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME,
|
|
|
|
include = As.PROPERTY, property = "type") @JsonSubTypes({
|
|
|
|
@JsonSubTypes.Type(value = SharedFolderEvent.class, name = "FOLDER_SHARE"),
|
|
|
|
@JsonSubTypes.Type(value = UnsharedFolderEvent.class, name = "FOLDER_UNSHARE"),
|
2022-05-04 16:35:59 +02:00
|
|
|
@JsonSubTypes.Type(value = RenamedFolderEvent.class, name = "FOLDER_RENAME"),
|
2022-05-04 11:26:41 +02:00
|
|
|
@JsonSubTypes.Type(value = AddedItemEvent.class, name = "ITEM_NEW")
|
|
|
|
})
|
|
|
|
public abstract class WorkspaceEvent {
|
|
|
|
protected final WorkspaceEventType TYPE;
|
|
|
|
|
2022-05-04 16:35:59 +02:00
|
|
|
/**
|
|
|
|
* the username of the user you wish to notify
|
|
|
|
*/
|
|
|
|
@JsonProperty("idsToNotify")
|
|
|
|
@NotNull(message="recipients cannot be missing, use usernames or contexts")
|
|
|
|
protected String[] idsToNotify;
|
2022-05-05 11:12:22 +02:00
|
|
|
|
|
|
|
/**
|
2022-05-05 11:17:11 +02:00
|
|
|
* @documentationExample false, optionl field, set to true if the idsToNotify are contexts, default is false
|
2022-05-05 11:12:22 +02:00
|
|
|
*/
|
|
|
|
@JsonProperty("idsAsGroup")
|
2022-05-04 16:35:59 +02:00
|
|
|
protected boolean idsAsGroup = false;
|
|
|
|
|
2022-05-04 11:26:41 +02:00
|
|
|
WorkspaceEvent(WorkspaceEventType TYPE) {
|
|
|
|
this.TYPE = TYPE;
|
|
|
|
}
|
|
|
|
|
2022-05-04 16:35:59 +02:00
|
|
|
/**
|
|
|
|
* @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;
|
|
|
|
}
|
2022-05-04 11:26:41 +02:00
|
|
|
public WorkspaceEventType getType() {
|
|
|
|
return TYPE;
|
|
|
|
}
|
2022-05-04 16:35:59 +02:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2022-05-04 11:26:41 +02:00
|
|
|
}
|