added partial support for workspace notifications

Feature/23186
Massimiliano Assante 2 years ago
parent b11217abf0
commit a0432fed4d

@ -11,20 +11,21 @@
## Documentation
* Use of this service is described in the [Wiki](https://wiki.gcube-system.org/gcube/OAuth2.0).
* Use of this service is described in the [Wiki](https://wiki.gcube-system.org/gcube/).
## Change log
See [Releases](https://code-repo.d4science.org/gCubeSystem/social-networking-library-ws/releases).
See [Releases](https://code-repo.d4science.org/gCubeSystem/social-service-model/releases).
## Authors
* **Massimiliano Assante** ([ORCID](https://orcid.org/0000-0002-3761-1492)) - [ISTI-CNR Infrascience Group](https://www.isti.cnr.it/People/M.Assante)
* **Costantino Perciante**
* **Massimiliano Assante** - [ISTI-CNR Infrascience Group](http://nemis.isti.cnr.it/groups/infrascience)
## Maintainers
* **Massimiliano Assante** - [ISTI-CNR Infrascience Group](http://nemis.isti.cnr.it/groups/infrascience)
* **Massimiliano Assante** ([ORCID](https://orcid.org/0000-0002-3761-1492)) - [ISTI-CNR Infrascience Group](https://www.isti.cnr.it/People/M.Assante)
## License
@ -37,12 +38,6 @@ open-source software toolkit used for building and operating Hybrid Data
Infrastructures enabling the dynamic deployment of Virtual Research Environments
by favouring the realisation of reuse oriented policies.
The projects leading to this software have received funding from a series of European Union programmes including:
- the Sixth Framework Programme for Research and Technological Development
- DILIGENT (grant no. 004260);
- the Seventh Framework Programme for research, technological development and demonstration
- D4Science (grant no. 212488), D4Science-II (grant no.239019), ENVRI (grant no. 283465), EUBrazilOpenBio (grant no. 288754), iMarine(grant no. 283644);
- the H2020 research and innovation programme
- BlueBRIDGE (grant no. 675680), EGIEngage (grant no. 654142), ENVRIplus (grant no. 654182), Parthenos (grant no. 654119), SoBigData (grant no. 654024),DESIRA (grant no. 818194), ARIADNEplus (grant no. 823914), RISIS2 (grant no. 824091), PerformFish (grant no. 727610), AGINFRAplus (grant no. 731001);
The projects leading to this software have received funding from a series of European Union programmes see [FUNDING.md](FUNDING.md)

@ -0,0 +1,131 @@
package org.gcube.social_networking.socialnetworking.model.beans;
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonProperty;
public class SharedFolderBean {
@JsonProperty("id")
@NotNull
private String id;
@JsonProperty("name")
@NotNull
private String name;
@JsonProperty("title")
@NotNull
private String title;
@JsonProperty("displayName")
@NotNull
private String displayName;
@JsonProperty("path")
@NotNull
private String path;
@JsonProperty("parentId")
@NotNull
private String parentId;
@JsonProperty("vreFolder")
@NotNull
boolean vreFolder;
public SharedFolderBean(String id, String name, String title, String displayName, String path, String parentId, boolean vreFolder) {
super();
this.id = id;
this.name = name;
this.title = title;
this.displayName = displayName;
this.path = path;
this.parentId = parentId;
this.vreFolder = vreFolder;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public boolean isVreFolder() {
return vreFolder;
}
public void setVreFolder(boolean vreFolder) {
this.vreFolder = vreFolder;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SharedFolderBean [id=");
builder.append(id);
builder.append(", name=");
builder.append(name);
builder.append(", displayName=");
builder.append(displayName);
builder.append(", path=");
builder.append(path);
builder.append(", parentId=");
builder.append(parentId);
builder.append(", vreFolder=");
builder.append(vreFolder);
builder.append("]");
return builder.toString();
}
}

@ -0,0 +1,59 @@
package org.gcube.social_networking.socialnetworking.model.beans;
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonProperty;
public class WSAddedItemNotificationBean implements WorkspaceNotificationBean {
/**
* the username of the user you wish to notify
*/
@JsonProperty("userIdToNotify")
@NotNull(message="recipient cannot be missing")
private String userIdToNotify;
@JsonProperty("fileItem")
@NotNull(message="fileItem cannot be missing")
private WorkspaceFileItemBean item;
@JsonProperty("folderItem")
@NotNull(message="folderItem cannot be missing")
private SharedFolderBean folder;
public WSAddedItemNotificationBean(String userIdToNotify, WorkspaceFileItemBean item, SharedFolderBean folder) {
super();
this.userIdToNotify = userIdToNotify;
this.item = item;
this.folder = folder;
}
public String getUserIdToNotify() {
return userIdToNotify;
}
public void setUserIdToNotify(String userIdToNotify) {
this.userIdToNotify = userIdToNotify;
}
public WorkspaceFileItemBean getItem() {
return item;
}
public void setItem(WorkspaceFileItemBean item) {
this.item = item;
}
public SharedFolderBean getFolder() {
return folder;
}
public void setFolder(SharedFolderBean folder) {
this.folder = folder;
}
@Override
public String toString() {
return "WSAddedItemNotificationBean [userIdToNotify=" + userIdToNotify + ", item=" + item + ", folder=" + folder
+ "]";
}
}

@ -0,0 +1,46 @@
package org.gcube.social_networking.socialnetworking.model.beans;
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonProperty;
public class WSSharedFolderNotificationBean implements WorkspaceNotificationBean {
/**
* the username of the user you wish to notify
*/
@JsonProperty("userIdToNotify")
@NotNull(message="recipient cannot be missing")
private String userIdToNotify;
@JsonProperty("folderItem")
@NotNull(message="folderItem cannot be missing")
private SharedFolderBean folder;
public WSSharedFolderNotificationBean(String userIdToNotify, SharedFolderBean folder) {
super();
this.userIdToNotify = userIdToNotify;
this.folder = folder;
}
public String getUserIdToNotify() {
return userIdToNotify;
}
public void setUserIdToNotify(String userIdToNotify) {
this.userIdToNotify = userIdToNotify;
}
public SharedFolderBean getFolder() {
return folder;
}
public void setFolder(SharedFolderBean folder) {
this.folder = folder;
}
@Override
public String toString() {
return "WSSharedFolderNotificationBean [userIdToNotify=" + userIdToNotify + ", folder=" + folder + "]";
}
}

@ -0,0 +1,100 @@
package org.gcube.social_networking.socialnetworking.model.beans;
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonProperty;
public class WorkspaceFileItemBean {
@JsonProperty("id")
@NotNull
private String id;
@JsonProperty("name")
@NotNull
private String name;
@JsonProperty("title")
@NotNull
private String title;
@JsonProperty("path")
@NotNull
private String path;
@JsonProperty("parent")
@NotNull
private SharedFolderBean parent;
public WorkspaceFileItemBean(String id, String name, String title, String path, SharedFolderBean parent) {
super();
this.id = id;
this.name = name;
this.title = title;
this.path = path;
this.parent = parent;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public SharedFolderBean getParent() {
return parent;
}
public void setParent(SharedFolderBean parent) {
this.parent = parent;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("WorkspaceFileItemBean [id=");
builder.append(id);
builder.append(", name=");
builder.append(name);
builder.append(", title=");
builder.append(title);
builder.append(", path=");
builder.append(path);
builder.append(", parent=");
builder.append(parent);
builder.append("]");
return builder.toString();
}
}

@ -0,0 +1,5 @@
package org.gcube.social_networking.socialnetworking.model.beans;
interface WorkspaceNotificationBean {
}

@ -0,0 +1,25 @@
package org.gcube.social_networking.socialnetworking.model.beans;
public class WorkspaceNotificationMessage {
private WorkspaceNotificationType type;
private WorkspaceNotificationBean bean;
public WorkspaceNotificationMessage(WorkspaceNotificationType type, WorkspaceNotificationBean bean) {
super();
this.type = type;
this.bean = bean;
}
public WorkspaceNotificationType getType() {
return type;
}
public WorkspaceNotificationBean getBean() {
return bean;
}
}

@ -0,0 +1,26 @@
package org.gcube.social_networking.socialnetworking.model.beans;
public enum WorkspaceNotificationType {
/**
* use to notify a user she got a workspace item new in some of her workspace shared folder
*/
WP_ITEM_NEW(WSAddedItemNotificationBean.class),
/**
* use to notify a user he got a workspace folder shared
*/
WP_FOLDER_SHARE(WSSharedFolderNotificationBean.class);
Class<? extends WorkspaceNotificationBean> beanClass;
WorkspaceNotificationType(Class<? extends WorkspaceNotificationBean> beanClass){
this.beanClass = beanClass;
}
public Class<? extends WorkspaceNotificationBean> getNotificationClass(){
return this.beanClass;
}
}
Loading…
Cancel
Save