New Social Model - Added databook.shared and databook.client to the model

This commit is contained in:
Ahmed Salah Tawfik Ibrahim 2024-01-15 18:18:21 +01:00
parent 59f2bab36c
commit 1b02ca6d12
40 changed files with 2090 additions and 0 deletions

17
pom.xml
View File

@ -27,6 +27,7 @@
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<gwtVersion>2.8.1</gwtVersion>
</properties>
<dependencyManagement>
@ -110,6 +111,22 @@
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.google</groupId>
<artifactId>gwt-jsonmaker</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='gcubesocialnetworking'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<inherits name="org.jsonmaker.gwt.Gwt_jsonmaker" />
<!-- Specify the app entry point class. -->
<entry-point class='org.gcube.social_networking.socialnetworking.model.client.GCubeSocialNetworking' />
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
</module>

View File

@ -0,0 +1,17 @@
package org.gcube.social_networking.socialnetworking.model.client;
import com.google.gwt.core.client.EntryPoint;
/**
* Entry point classes define <code>onModuleLoad()</code> and instances the <code>HandlerManager</code> for IPC
*/
public class GCubeSocialNetworking implements EntryPoint {
public static final String USER_PROFILE_OID = "userIdentificationParameter";
public static final String HASHTAG_OID = "hashtagIdentificationParameter";
public static final String SEARCH_OID = "elasticSearchIdentificationParameter";
public static final String SHOW_STATISTICS_ACTION_OID = "showUserStatisticsActionParameter"; // see ShowUserStatisticAction
public static final String GROUP_MEMBERS_OID = "teamIdentificationParameter";
public void onModuleLoad() {
}
}

View File

@ -0,0 +1,15 @@
package org.gcube.social_networking.socialnetworking.model.client.util;
/**
* simply encode base64 strings
* @author massi
*
*/
public class Encoder {
public static native String encode(String toEncode) /*-{
return btoa(toEncode);
}-*/;
public static native String decode(String toDecode) /*-{
return atob(toDecode);
}-*/;
}

View File

@ -0,0 +1,77 @@
package org.gcube.social_networking.socialnetworking.model.shared;
import java.io.Serializable;
/**
*
* @author Massimiliano Assante, ISTI-CNR
* @version 0.1 Dec 2012
*
*/
@SuppressWarnings("serial")
public class ApplicationProfile implements Serializable {
private String key;
private String name;
private String description;
private String imageUrl;
private String scope;
private String url;
public ApplicationProfile() {
super();
}
public ApplicationProfile(String key, String name, String description, String imageUrl, String scope, String url) {
super();
this.key = key;
this.name = name;
this.description = description;
this.imageUrl = imageUrl;
this.scope = scope;
this.url = url;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
@Override
public String toString() {
return "ApplicationProfile [key=" + key + ", name=" + name + ", description="
+ description + ", imageUrl=" + imageUrl + ", scope=" + scope
+ ", url=" + url + "]";
}
}

View File

@ -0,0 +1,104 @@
package org.gcube.social_networking.socialnetworking.model.shared;
import java.io.Serializable;
import org.jsonmaker.gwt.client.Jsonizer;
@SuppressWarnings("serial")
public class Attachment implements Serializable {
public interface AttachmentJsonizer extends Jsonizer {}
private String id;
private String uri;
private String name;
private String description;
private String thumbnailURL;
private String mimeType;
public Attachment() {
super();
}
/**
* @param id the id in the cassandra CF
* @param uri where you can download the file from
* @param name the name of the attached file
* @param description the description of the attached file
* @param thumbnailURL the URL of the image representing the attached file
* @param mimeType the type of file
*/
public Attachment(String id, String uri, String name, String description,
String thumbnailURL, String mimeType) {
super();
this.id = id;
this.uri = uri;
this.name = name;
this.description = description;
this.thumbnailURL = thumbnailURL;
this.mimeType = mimeType;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getThumbnailURL() {
return thumbnailURL;
}
public void setThumbnailURL(String thumbnailURL) {
this.thumbnailURL = thumbnailURL;
}
public String getMimeType() {
return mimeType;
}
public void setMimeType(String mimeType) {
this.mimeType = mimeType;
}
@Override
public String toString() {
return "Attachment [uri=" + uri + ", name=" + name + ", description="
+ description + ", thumbnailURL=" + thumbnailURL
+ ", mimeType=" + mimeType + "]";
}
}

View File

@ -0,0 +1,34 @@
package org.gcube.social_networking.socialnetworking.model.shared;
import jsinterop.annotations.JsOverlay;
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsType;
@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object")
public class ClientAttachment {
public String id;
public String uri;
public String name;
public String description;
public String thumbnailURL;
public String mimeType;
/**
* @param id the id in the cassandra CF
* @param uri where you can download the file from
* @param name the name of the attached file
* @param description the description of the attached file
* @param thumbnailURL the URL of the image representing the attached file
* @param mimeType the type of file
*/
@JsOverlay
public static ClientAttachment create(String id, String uri, String name, String description, String thumbnailURL, String mimeType) {
ClientAttachment o = new ClientAttachment();
o.id = id;
o.uri = uri;
o.name = name;
o.description = description;
o.thumbnailURL = thumbnailURL;
o.mimeType = mimeType;
return o;
}
}

View File

@ -0,0 +1,51 @@
package org.gcube.social_networking.socialnetworking.model.shared;
import java.util.Date;
import jsinterop.annotations.JsOverlay;
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsType;
/**
*
* @author Massimiliano Assante, CNR-ISTI
* Uses JsInterop annotations to deserialize the object
*/
@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object")
public class ClientPost {
public String key;
public String type;
public String userid;
public Date time;
public String uri;
public String description;
public String fullName;
public String email;
public String thumbnailURL;
public String linkTitle;
public String linkDescription;
public String linkUrlThumbnail;
public String linkHost;
public ClientAttachment[] attachments;
@JsOverlay
public static ClientPost create(String key, String type, String userid, Date time,
String uri, String description, String fullName, String email,
String thumbnailURL, String linkTitle, String linkDescription,
String linkUrlThumbnail, String linkHost, ClientAttachment[] attachments) {
ClientPost o = new ClientPost();
o.key = key;
o.type = type;
o.userid = userid;
o.time = time;
o.uri = uri;
o.description = description;
o.fullName = fullName;
o.email = email;
o.thumbnailURL = thumbnailURL;
o.linkTitle = linkTitle;
o.linkDescription = linkDescription;
o.linkUrlThumbnail = linkUrlThumbnail;
o.linkHost = linkHost;
o.attachments = attachments;
return o;
}
}

View File

@ -0,0 +1,175 @@
package org.gcube.social_networking.socialnetworking.model.shared;
import java.io.Serializable;
import java.util.Date;
/**
*
* @author Massimiliano Assante, ISTI-CNR
* @version 0.1 July 2012
*
*/
@SuppressWarnings("serial")
public class Comment implements Serializable, Comparable<Comment> {
private String key;
private String userid;
private Date time;
private String postid;
private String text;
private String fullName;
private String thumbnailURL;
private boolean isEdit; // false default
private Date lastEditTime; // null default
/**
*
*/
public Comment() {
super();
}
/**
*
* @param key
* @param userid
* @param time
* @param postid
* @param text
* @param fullName
* @param thumbnailURL
*/
public Comment(String key, String userid, Date time, String postid,
String text, String fullName, String thumbnailURL) {
super();
this.key = key;
this.userid = userid;
this.time = time;
this.postid = postid;
this.text = text;
this.fullName = fullName;
this.thumbnailURL = thumbnailURL;
this.isEdit = false;
this.lastEditTime = null;
}
/**
* Constructor for edited comment
* @param key
* @param userid
* @param time
* @param postid
* @param text
* @param fullName
* @param thumbnailURL
* @param isEdit
* @param editDate
*/
public Comment(String key, String userid, Date time, String postid,
String text, String fullName, String thumbnailURL, boolean isEdit, Date editDate) {
super();
this.key = key;
this.userid = userid;
this.time = time;
this.postid = postid;
this.text = text;
this.fullName = fullName;
this.thumbnailURL = thumbnailURL;
this.isEdit = isEdit;
this.lastEditTime = editDate;
}
/**
*
* @return the text
*/
public String getText() {
return text;
}
/**
*
* @param text text to add as string
*/
public void setText(String text) {
this.text = text;
}
/**
*
* @return the uuid
*/
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getUserid() {
return userid;
}
public void setUserid(String userid) {
this.userid = userid;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
public String getPostid() {
return postid;
}
public void setPostid(String postid) {
this.postid = postid;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getThumbnailURL() {
return thumbnailURL;
}
public void setThumbnailURL(String thumbnailURL) {
this.thumbnailURL = thumbnailURL;
}
public boolean isEdit() {
return isEdit;
}
public void setEdit(boolean isEdit) {
this.isEdit = isEdit;
}
public Date getLastEditTime() {
return lastEditTime;
}
public void setLastEditTime(Date lastEditTime) {
this.lastEditTime = lastEditTime;
}
public int compareTo(Comment toCompare) {
if (this.time.after(toCompare.getTime()))
return 1;
if (this.time.before(toCompare.getTime()))
return -1;
return 0;
}
@Override
public String toString() {
return "Comment [key=" + key + ", userid=" + userid + ", time=" + time
+ ", postid=" + postid + ", text=" + text + ", fullName="
+ fullName + ", thumbnailURL=" + thumbnailURL + ", isEdit="
+ isEdit + ", lastEditTime=" + lastEditTime + "]";
}
}

View File

@ -0,0 +1,85 @@
package org.gcube.social_networking.socialnetworking.model.shared;
import java.io.Serializable;
import java.util.ArrayList;
/**
*
* @author massi
* This class contains addtional user related information about a post
* e.g. if this user has liked it
*/
@SuppressWarnings("serial")
public class EnhancedPost implements Serializable{
private Post post;
private boolean liked;
private boolean isUsers;
private ArrayList<Comment> comments;
private ArrayList<Attachment> attachments;
public EnhancedPost() {
super();
}
public EnhancedPost(Post post, boolean liked, boolean isUsers) {
super();
this.post = post;
this.liked = liked;
this.isUsers = isUsers;
}
public EnhancedPost(Post post, boolean liked, boolean isUsers, ArrayList<Comment> comments) {
super();
this.isUsers = isUsers;
this.post = post;
this.liked = liked;
this.comments = comments;
}
public EnhancedPost(Post post, boolean liked, boolean isUsers,
ArrayList<Comment> comments, ArrayList<Attachment> attachments) {
super();
this.post = post;
this.liked = liked;
this.isUsers = isUsers;
this.comments = comments;
this.attachments = attachments;
}
public ArrayList<Comment> getComments() {
return comments;
}
public void setComments(ArrayList<Comment> comments) {
this.comments = comments;
}
public Post getPost() {
return post;
}
public void setPost(Post post) {
this.post = post;
}
public boolean isLiked() {
return liked;
}
public void setLiked(boolean liked) {
this.liked = liked;
}
public boolean isUsers() {
return isUsers;
}
public void setUsers(boolean isUsers) {
this.isUsers = isUsers;
}
public ArrayList<Attachment> getAttachments() {
return attachments;
}
public void setAttachments(ArrayList<Attachment> attachments) {
this.attachments = attachments;
}
@Override
public String toString() {
return "EnhancedPost [post=" + post + ", liked=" + liked + ", isUsers="
+ isUsers + ", comments=" + comments + ", attachments="
+ attachments + "]";
}
}

View File

@ -0,0 +1,5 @@
package org.gcube.social_networking.socialnetworking.model.shared;
public enum ImageType {
JPG, GIF, PNG, TIFF, PDF, BMP;
}

View File

@ -0,0 +1,144 @@
package org.gcube.social_networking.socialnetworking.model.shared;
import java.io.Serializable;
import java.util.Date;
/**
*
* @author Massimiliano Assante, ISTI-CNR
*
*/
@SuppressWarnings("serial")
public class Invite implements Serializable {
private String key;
private String senderUserId;
private String vreid;
private String invitedEmail;
private String controlCode;
private InviteStatus status;
private Date time;
private String senderFullName;
public Invite() {
super();
}
public Invite(String key, String senderUserId, String vreid,
String invitedEmail, String controlCode, InviteStatus status,
Date time, String senderFullName) {
super();
this.key = key;
this.senderUserId = senderUserId;
this.vreid = vreid;
this.invitedEmail = invitedEmail;
this.controlCode = controlCode;
this.status = status;
this.time = time;
this.senderFullName = senderFullName;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getSenderUserId() {
return senderUserId;
}
public void setSenderUserId(String senderUserId) {
this.senderUserId = senderUserId;
}
public String getVreid() {
return vreid;
}
public void setVreid(String vreid) {
this.vreid = vreid;
}
public String getInvitedEmail() {
return invitedEmail;
}
public void setInvitedEmail(String invitedEmail) {
this.invitedEmail = invitedEmail;
}
public String getControlCode() {
return controlCode;
}
public void setControlCode(String controlCode) {
this.controlCode = controlCode;
}
public InviteStatus getStatus() {
return status;
}
public void setStatus(InviteStatus status) {
this.status = status;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
public String getSenderFullName() {
return senderFullName;
}
public void setSenderFullName(String senderFullName) {
this.senderFullName = senderFullName;
}
@Override
public String toString() {
return "Invite [key=" + key + ", senderUserId=" + senderUserId
+ ", vreid=" + vreid + ", invitedEmail=" + invitedEmail
+ ", controlCode=" + controlCode + ", status=" + status
+ ", time=" + time + ", senderFullName=" + senderFullName + "]";
}
}

View File

@ -0,0 +1,8 @@
package org.gcube.social_networking.socialnetworking.model.shared;
public enum InviteOperationResult {
SUCCESS,
FAILED,
//If I send an invite the same email in the same environment more than once
ALREADY_INVITED;
}

View File

@ -0,0 +1,20 @@
package org.gcube.social_networking.socialnetworking.model.shared;
public enum InviteStatus {
/**
* First status of anyh invite
*/
PENDING,
/**
* User accepted the invite
*/
ACCEPTED,
/**
* User rejected the invite
*/
REJECTED,
/**
* Manager withdrawed the invite
*/
RETRACTED;
}

View File

@ -0,0 +1,10 @@
package org.gcube.social_networking.socialnetworking.model.shared;
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsType;
@JsType(isNative = true, namespace = JsPackage.GLOBAL)
public class JSON {
public static native String stringify(Object o);
public static native <O> O parse(String json);
}

View File

@ -0,0 +1,53 @@
package org.gcube.social_networking.socialnetworking.model.shared;
/**
*
* @author Massimiliano Assante, ISTI-CNR
* @version 0.1 Dec 2012
*
*/
public enum JobStatusType {
/**
* The job has been cancelled.
*/
CANCELLED,
/**
* The job is in the process of being cancelled.
*/
CANCELLING,
/**
* The job has been deleted.
*/
DELETED,
/**
* The job is in the process of being deleted.
*/
DELETING,//
/**
* The job is being executed by job processor.
*/
EXECUTING,//
/**
* he job execution has failed.
*/
FAILED,
/**
* The job is new.
*/
NEW,//
/**
* The job is submitted for execution.
*/
SUBMITTED,
/**
* The job has completed successfully
*/
SUCCEEDED,
/**
* The job execution has timed out.
*/
TIMED_OUT,
/**
* The job is waiting for available job processor.
*/
WAITING
}

View File

@ -0,0 +1,88 @@
package org.gcube.social_networking.socialnetworking.model.shared;
import java.io.Serializable;
import java.util.Date;
/**
*
* @author Massimiliano Assante, ISTI-CNR
* @version 0.1 July 2012
*
*/
@SuppressWarnings("serial")
public class Like implements Serializable {
private String key;
private String userid;
private Date time;
private String postid;
private String fullName;
private String thumbnailURL;
public Like() {
super();
}
public Like(String key, String userid, Date time, String postid,
String fullName, String thumbnailURL) {
super();
this.key = key;
this.userid = userid;
this.time = time;
this.postid = postid;
this.fullName = fullName;
this.thumbnailURL = thumbnailURL;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getUserid() {
return userid;
}
public void setUserid(String userid) {
this.userid = userid;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
public String getPostid() {
return postid;
}
public void setPostid(String postid) {
this.postid = postid;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getThumbnailURL() {
return thumbnailURL;
}
public void setThumbnailURL(String thumbnailURL) {
this.thumbnailURL = thumbnailURL;
}
public String toString() {
return "KEY: " + key + " Time: "+ time + "\nuserid: "+userid + " Full name: " + fullName;
}
}

View File

@ -0,0 +1,193 @@
package org.gcube.social_networking.socialnetworking.model.shared;
import java.io.Serializable;
import java.util.Date;
/**
*
* @author Massimiliano Assante, ISTI-CNR
*
*/
@SuppressWarnings("serial")
public class Notification implements Serializable {
private String key;
private NotificationType type;
private String userid;
private String subjectid;
private Date time;
private String uri;
private String description;
private boolean read;
private String senderid;
private String senderFullName;
private String senderThumbnail;
private String commentKey;
/**
* default constructor
*/
public Notification() {
super();
}
/**
*
* @param key
* @param type
* @param userid
* @param subjectid the subject id of this notification, if is a like on a post then is the postid, it is a message then is the messageid and so on
* @param time
* @param uri
* @param description
* @param read
* @param senderid
* @param senderFullName
* @param senderThumbnail
*/
public Notification(String key, NotificationType type, String userid,
String subjectid, Date time, String uri, String description,
boolean read, String senderid, String senderFullName,
String senderThumbnail) {
super();
this.key = key;
this.type = type;
this.userid = userid;
this.subjectid = subjectid;
this.time = time;
this.uri = uri;
this.description = description;
this.read = read;
this.senderid = senderid;
this.senderFullName = senderFullName;
this.senderThumbnail = senderThumbnail;
}
/**
*
* @param key
* @param type
* @param userid
* @param subjectid the subject id of this notification, if is a like on a post then is the postid, it is a message then is the messageid and so on
* @param time
* @param uri
* @param description
* @param read
* @param senderid
* @param senderFullName
* @param senderThumbnail
* @param commentKey when a mail notification must be sent, stop the embedded discussion at this comment
*/
public Notification(String key, NotificationType type, String userid,
String subjectid, Date time, String uri, String description,
boolean read, String senderid, String senderFullName,
String senderThumbnail, String commentKey) {
super();
this.key = key;
this.type = type;
this.userid = userid;
this.subjectid = subjectid;
this.time = time;
this.uri = uri;
this.description = description;
this.read = read;
this.senderid = senderid;
this.senderFullName = senderFullName;
this.senderThumbnail = senderThumbnail;
this.commentKey = commentKey;
}
/**
*
* @return .
*/
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public NotificationType getType() {
return type;
}
public void setType(NotificationType type) {
this.type = type;
}
public String getUserid() {
return userid;
}
public void setUserid(String userid) {
this.userid = userid;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public boolean isRead() {
return read;
}
public void setRead(boolean read) {
this.read = read;
}
public String getSenderid() {
return senderid;
}
public void setSenderid(String senderid) {
this.senderid = senderid;
}
public String getSenderFullName() {
return senderFullName;
}
public void setSenderFullName(String senderFullName) {
this.senderFullName = senderFullName;
}
public String getSenderThumbnail() {
return senderThumbnail;
}
public void setSenderThumbnail(String senderThumbnail) {
this.senderThumbnail = senderThumbnail;
}
public String getSubjectid() {
return subjectid;
}
public void setSubjectid(String subjectid) {
this.subjectid = subjectid;
}
public String getCommentKey() {
return commentKey;
}
public void setCommentKey(String commentKey) {
this.commentKey = commentKey;
}
@Override
public String toString() {
return "Notification [key=" + key + ", type=" + type + ", userid="
+ userid + ", subjectid=" + subjectid + ", time=" + time
+ ", uri=" + uri + ", description=" + description + ", read="
+ read + ", senderid=" + senderid + ", senderFullName="
+ senderFullName + ", senderThumbnail=" + senderThumbnail
+ ", commentKey=" + commentKey + "]";
}
}

View File

@ -0,0 +1,20 @@
package org.gcube.social_networking.socialnetworking.model.shared;
/**
* @author Massimiliano Assante ISTI-CNR
*
* @version 1.0 January 2012
*/
public enum NotificationChannelType {
/**
* PORTAL
*/
PORTAL,
/**
* EMAIL
*/
EMAIL,
/**
* TWITTER
*/
TWITTER;
}

View File

@ -0,0 +1,181 @@
package org.gcube.social_networking.socialnetworking.model.shared;
/**
* @author Massimiliano Assante ISTI-CNR
*
* TODO: Buggy if NotificationType for WP_* are refactored see DBCassandraAstyanaxImpl#getUserNotificationPreferences(String userid)
* introduced due to urgent matters
*/
public enum NotificationType {
/**
* use to notify a user he got a Tabular Resource shared
*/
TDM_TAB_RESOURCE_SHARE,
/**
* use to notify a user he got a TDM Rule shared
*/
TDM_RULE_SHARE,
/**
* use to notify a user he got a TDM Templated shared
*/
TDM_TEMPLATE_SHARE,
/**
* use to notify a user he got a workspace folder shared
*/
WP_FOLDER_SHARE,
/**
* use to notify a user that a user in the share unshared
*/
WP_FOLDER_UNSHARE,
/**
* use to notify a user that he got upgraded to administrator of a shared folder
*/
WP_ADMIN_UPGRADE,
/**
* use to notify a user that he got downgraded from administrator of a shared folder
*/
WP_ADMIN_DOWNGRADE,
/**
* use to notify a user that a new user was added in on of his workspace shared folder
*/
WP_FOLDER_ADDEDUSER,
/**
* use to notify a user that an existing user was removed from one of his workspace shared folder
*/
WP_FOLDER_REMOVEDUSER,
/**
* use to notify a user he got a workspace folder renamed
*/
WP_FOLDER_RENAMED,
/**
* use to notify a user he got a workspace item deleted from one of his workspace shared folder
*/
WP_ITEM_DELETE,
/**
* use to notify a user he got a workspace item updated from one of his workspace shared folder
*/
WP_ITEM_UPDATED,
/**
* use to notify a user he got a workspace item renamed from one of his workspace shared folder
*/
WP_ITEM_RENAMED,
/**
* use to notify a user he got a workspace item new in some of his workspace shared folder
*/
WP_ITEM_NEW,
/**
* use to notify a user he got one of his post commented
*/
OWN_COMMENT,
/**
* use to notify a user that commented on a post (Not his) that someone commented too
*/
COMMENT,
/**
* use to notify a user that he got mentioned in one post
*/
MENTION,
/**
* use to notify a user he got one of his post liked
*/
LIKE,
/**
* use to notify a user he got a message
*/
MESSAGE,
/**
* use to notify every user of a VRE/Group that the post was made
*/
POST_ALERT,
/**
* use to notify a user that someone in his VRE created a new Event in the Calendar
*/
CALENDAR_ADDED_EVENT,
/**
* use to notify a user that someone in his VRE updated an Event in the Calendar
*/
CALENDAR_UPDATED_EVENT,
/**
* use to notify a user that someone in his VRE deleted an Event in the Calendar
*/
CALENDAR_DELETED_EVENT,
/**
* use to notify a user he got a connections request
*/
REQUEST_CONNECTION,
/**
* use to notify a user he got a job completed ok
*/
JOB_COMPLETED_OK,
/**
* use to notify a user he got a job completed not ok
*/
JOB_COMPLETED_NOK,
/**
* use to notify a document workflow owner that someone
* has edited a document involved in a worflow he created
*/
@Deprecated
DOCUMENT_WORKFLOW_EDIT,
/**
* use to notify a document workflow owner that someone
* has viewed a document involved in a worflow he created
*/
@Deprecated
DOCUMENT_WORKFLOW_VIEW,
/**
* use to notify a document workflow user (user that in the same document workflow)
* that forwarded to a step where he is requested to do a task
*/
@Deprecated
DOCUMENT_WORKFLOW_STEP_REQUEST_TASK,
/**
* use to notify a document workflow user that he was involved into a new Document Workflow
* and he is requested to do a task
*/
@Deprecated
DOCUMENT_WORKFLOW_FIRST_STEP_REQUEST_INVOLVMENT,
/**
* use to notify a document workflow owner that a user performed a forward action to another step a document worflow he created
*/
@Deprecated
DOCUMENT_WORKFLOW_USER_FORWARD_TO_OWNER,
/**
* use to notify a document workflow owner that someone
* forwarded and the workflow moved to another step a document worflow he created
*/
@Deprecated
DOCUMENT_WORKFLOW_FORWARD_STEP_COMPLETED_OWNER,
/**
* use to notify a document workflow peer (user that in the same step has your same role)
* that someone performed a forward action to another step in a document worflow he is involved into
*/
@Deprecated
DOCUMENT_WORKFLOW_STEP_FORWARD_PEER,
/**
* catalogue, use to notify someone submits an item for consideration
*/
CAT_ITEM_SUBMITTED,
/**
* catalogue, use to notify someone rejected a submitted item
*/
CAT_ITEM_REJECTED,
/**
* catalogue, use to notify someone published an item
*/
CAT_ITEM_PUBLISHED,
/**
* catalogue, use to notify someone updated an item
*/
CAT_ITEM_UPDATED,
/**
* catalogue, use to notify someone removed an item
*/
CAT_ITEM_DELETE,
/**
* generic notification
*/
GENERIC;
}

View File

@ -0,0 +1,322 @@
package org.gcube.social_networking.socialnetworking.model.shared;
import java.io.Serializable;
import java.util.Date;
/**
*
* @author Massimiliano Assante, ISTI-CNR
*
*/
@SuppressWarnings("serial")
public class Post implements Serializable, Comparable<Post> {
private String key;
private PostType type;
private String entityId;
private Date time;
private String vreid;
private String uri;
private String uriThumbnail;
private String description;
private PrivacyLevel privacy;
private String fullName;
private String email;
private String thumbnailURL;
private String commentsNo;
private String likesNo;
private String linkTitle;
private String linkDescription;
private String linkHost;
boolean applicationPost;
/**
* this boolean indicates that the attachments to the post are > 1
*/
boolean multiFileUpload;
/**
* default constructor
*/
public Post() {
super();
}
/**
* To use ONLY for USER Posts
*
*
* @param key a UUID
* @param type an instance of <class>PostType</class>
* @param entityId the user or the app unique indentifier
* @param time when
* @param vreid a unique vre id
* @param uri optional uri
* @param uriThumbnail the thumbnail for the link posted
* @param description optional description
* @param privacy the privacy level of <class>PrivacyLevel</class>
* @param fullName
* @param email
* @param thumbnailURL this is the user thumbnail url
* @param linkTitle optional to be used when posting links
* @param linkDescription optional to be used when posting links
* @param linkHost option to be used when posting linkgs
*/
public Post(String key, PostType type, String entityId, Date time,
String vreid, String uri, String uriThumbnail, String description, PrivacyLevel privacy,
String fullName, String email, String thumbnailURL, String linkTitle, String linkDescription, String linkHost) {
this.key = key;
this.type = type;
this.entityId = entityId;
this.time = time;
this.vreid = vreid;
this.uri = uri;
this.uriThumbnail = uriThumbnail;
this.description = description;
this.privacy = privacy;
this.fullName = fullName;
this.email = email;
this.thumbnailURL = thumbnailURL;
this.commentsNo = "0";
this.likesNo = "0";
this.linkDescription = linkDescription;
this.linkTitle = linkTitle;
this.linkHost = linkHost;
this.applicationPost = false;
}
/**
* To use for USER and ApplicationProfile Posts
*
* @param key a UUID
* @param type an instance of <class>PostType</class>
* @param entityId the user or the app unique indentifier
* @param time when
* @param vreid a unique vre id
* @param uri optional uri
* @param uriThumbnail the thumbnail for the link posted
* @param description optional description
* @param privacy the privacy level of <class>PrivacyLevel</class>
* @param fullName
* @param email
* @param thumbnailURL this is the user thumbnail url
* @param linkTitle optional to be used when posting links
* @param linkDescription optional to be used when posting links
* @param applicationPost tell if this is an application post or a user post
*/
public Post(String key, PostType type, String entityId, Date time,
String vreid, String uri, String uriThumbnail, String description, PrivacyLevel privacy,
String fullName, String email, String thumbnailURL, String linkTitle, String linkDescription, String linkHost, boolean applicationPost) {
this(key, type, entityId, time, vreid, uri, uriThumbnail, description, privacy, fullName, email, thumbnailURL, linkTitle, linkDescription, linkHost);
this.applicationPost = applicationPost;
}
/**
* for serialization purposes
* @param key a UUID
* @param type an instance of <class>PostType</class>
* @param entityId the user or the app unique indentifier
* @param time when
* @param vreid a unique vre id
* @param uri optional uri
* @param uriThumbnail the thumbnail for the link posted
* @param description optional description
* @param privacy the privacy level of <class>PrivacyLevel</class>
* @param fullName
* @param email
* @param thumbnailURL this is the user thumbnail url
* @param linkTitle optional to be used when posting links
* @param linkDescription optional to be used when posting links
*/
public Post(String key, PostType type, String entityId, Date time,
String vreid, String uri, String uriThumbnail, String description, PrivacyLevel privacy,
String fullName, String email, String thumbnailURL, String commentsNo,
String likesNo, String linkTitle, String linkDescription, String linkHost, boolean applicationPost, boolean multiFileUpload) {
super();
this.key = key;
this.type = type;
this.entityId = entityId;
this.time = time;
this.vreid = vreid;
this.uri = uri;
this.uriThumbnail = uriThumbnail;
this.description = description;
this.privacy = privacy;
this.fullName = fullName;
this.email = email;
this.thumbnailURL = thumbnailURL;
this.commentsNo = commentsNo;
this.likesNo = likesNo;
this.linkDescription = linkDescription;
this.linkTitle = linkTitle;
this.linkHost = linkHost;
this.applicationPost = applicationPost;
this.multiFileUpload = multiFileUpload;
}
/**
*
* @return post id
*/
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public PostType getType() {
return type;
}
public void setType(PostType type) {
this.type = type;
}
/**
*
* @return the User or the App id
*/
public String getEntityId() {
return entityId;
}
/**
* set the User or the App id
* @param entityId the UserId or the AppId id
*/
public void setEntityId(String entityId) {
this.entityId = entityId;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
public String getVreid() {
return vreid;
}
public void setVreid(String vreid) {
this.vreid = vreid;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public PrivacyLevel getPrivacy() {
return privacy;
}
public void setPrivacy(PrivacyLevel privacy) {
this.privacy = privacy;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getThumbnailURL() {
return thumbnailURL;
}
public void setThumbnailURL(String thumbnailURL) {
this.thumbnailURL = thumbnailURL;
}
public String getCommentsNo() {
return commentsNo;
}
public void setCommentsNo(String commentsNo) {
this.commentsNo = commentsNo;
}
public String getLikesNo() {
return likesNo;
}
public void setLikesNo(String likesNo) {
this.likesNo = likesNo;
}
public String getUriThumbnail() {
return uriThumbnail;
}
public void setUriThumbnail(String uriThumbnail) {
this.uriThumbnail = uriThumbnail;
}
public String getLinkTitle() {
return linkTitle;
}
public void setLinkTitle(String linkTitle) {
this.linkTitle = linkTitle;
}
public String getLinkDescription() {
return linkDescription;
}
public void setLinkDescription(String linkDescription) {
this.linkDescription = linkDescription;
}
public int compareTo(Post toCompare) {
if (this.time.after(toCompare.getTime()))
return 1;
if (this.time.before(toCompare.getTime()))
return -1;
return 0;
}
public String getLinkHost() {
return linkHost;
}
public void setLinkHost(String linkHost) {
this.linkHost = linkHost;
}
public boolean isApplicationPost() {
return applicationPost;
}
public void setApplicationPost(boolean applicationPost) {
this.applicationPost = applicationPost;
}
public boolean isMultiFileUpload() {
return multiFileUpload;
}
public void setMultiFileUpload(boolean multiFileUpload) {
this.multiFileUpload = multiFileUpload;
}
@Override
public String toString() {
return "Post [key=" + key + ", type=" + type + ", entityId=" + entityId
+ ", time=" + time + ", vreid=" + vreid + ", uri=" + uri
+ ", uriThumbnail=" + uriThumbnail + ", description="
+ description + ", privacy=" + privacy + ", fullName="
+ fullName + ", email=" + email + ", thumbnailURL="
+ thumbnailURL + ", commentsNo=" + commentsNo + ", likesNo="
+ likesNo + ", linkTitle=" + linkTitle + ", linkDescription="
+ linkDescription + ", linkHost=" + linkHost
+ ", applicationPost=" + applicationPost
+ ", multiFileUpload=" + multiFileUpload + "]";
}
}

View File

@ -0,0 +1,18 @@
package org.gcube.social_networking.socialnetworking.model.shared;
/**
* @author Massimiliano Assante ISTI-CNR
*
*/
public enum PostType {
JOIN, SHARE, PUBLISH, TWEET, CONNECTED,
/**
* Special case used when accounting
*/
ACCOUNTING,
/**
* Special case used when a Post is removed
*/
DISABLED;
}

View File

@ -0,0 +1,56 @@
package org.gcube.social_networking.socialnetworking.model.shared;
import java.io.Serializable;
import java.util.List;
@SuppressWarnings("serial")
public class PostWithAttachment implements Serializable {
private Post post;
private List<Attachment> attachments;
public PostWithAttachment(Post post, List<Attachment> attachments){
super();
this.post = post;
this.attachments = attachments;
}
public void setAttachments(List<Attachment> attachments) {
this.attachments = attachments;
}
public void setPost(Post post) {
this.post = post;
}
public List<Attachment> getAttachments() {
return attachments;
}
public Post getPost() {
return post;
}
public String toString() {
String postInfo = "Post [key=" + post.getKey() + ", type=" + post.getType() + ", entityId=" + post.getEntityId()
+ ", time=" + post.getTime() + ", vreid=" + post.getVreid() + ", uri=" + post.getUri()
+ ", uriThumbnail=" + post.getUriThumbnail() + ", description="
+ post.getDescription() + ", privacy=" + post.getPrivacy() + ", fullName="
+ post.getFullName() + ", email=" + post.getEmail() + ", thumbnailURL="
+ post.getThumbnailURL() + ", commentsNo=" + post.getCommentsNo() + ", likesNo="
+ post.getLikesNo() + ", linkTitle=" + post.getLinkTitle() + ", linkDescription="
+ post.getLinkDescription() + ", linkHost=" + post.getLinkHost()
+ ", applicationPost=" + post.isApplicationPost()
+ ", multiFileUpload=" + post.isMultiFileUpload() + "]";
String attachmentInfo = "[Attachments: ";
for (Attachment attachment: attachments){
attachmentInfo += "[Attachment [key=" + attachment.getId() + ", uri=" + attachment.getUri() + ", name=" + attachment.getName() + ", description="
+ attachment.getDescription() + ", thumbnailURL=" + attachment.getThumbnailURL()
+ ", mimeType=" + attachment.getMimeType() + "]],";
}
attachmentInfo = attachmentInfo.substring(0, attachmentInfo.length()-1);
attachmentInfo += "]";
;
return "[" + postInfo + ", " + attachmentInfo + "]" ;
}
}

View File

@ -0,0 +1,9 @@
package org.gcube.social_networking.socialnetworking.model.shared;
/**
* @author Massimiliano Assante ISTI-CNR
*
* @version 1.0 July 6th 2012
*/
public enum PrivacyLevel {
PRIVATE, CONNECTION, VRES, SINGLE_VRE, PORTAL, PUBLIC;
}

View File

@ -0,0 +1,40 @@
package org.gcube.social_networking.socialnetworking.model.shared;
import java.io.Serializable;
import java.util.ArrayList;
/**
*
* @author Massimiliano Assante, ISTI-CNR
*
*/
@SuppressWarnings("serial")
public class RangePosts implements Serializable {
private int lastReturnedPostTimelineIndex;
private ArrayList<Post> posts;
public RangePosts() {
super();
}
public RangePosts(int lastReturnedPostTimelineIndex, ArrayList<Post> posts) {
super();
this.lastReturnedPostTimelineIndex = lastReturnedPostTimelineIndex;
this.posts = posts;
}
public int getLastReturnedPostTimelineIndex() {
return lastReturnedPostTimelineIndex;
}
public void setLastReturnedPostTimelineIndex(int lastReturnedPostTimelineIndex) {
this.lastReturnedPostTimelineIndex = lastReturnedPostTimelineIndex;
}
public ArrayList<Post> getPosts() {
return posts;
}
public void setPosts(ArrayList<Post> posts) {
this.posts = posts;
}
}

View File

@ -0,0 +1,83 @@
package org.gcube.social_networking.socialnetworking.model.shared;
import java.io.Serializable;
/**
* The RunningJob class.
* @author Massimiliano Assante, ISTI-CNR (massimiliano.assante@isti.cnr.it)
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
@SuppressWarnings("serial")
public class RunningJob implements Serializable {
private String jobId;
private String jobName;
private JobStatusType status;
private String message;
private String serviceName; // i.e., Dataminer, SmartExecutor..
public RunningJob() {
super();
}
/** Buind a RunningJob object.
* @param jobId
* @param jobName
* @param status
* @param message
* @param serviceName
*/
public RunningJob(String jobId, String jobName, JobStatusType status,
String message, String serviceName) {
super();
this.jobId = jobId;
this.jobName = jobName;
this.status = status;
this.message = message;
this.serviceName = serviceName;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getJobId() {
return jobId;
}
public void setJobId(String jobId) {
this.jobId = jobId;
}
public String getJobName() {
return jobName;
}
public void setJobName(String jobName) {
this.jobName = jobName;
}
public JobStatusType getStatus() {
return status;
}
public void setStatus(JobStatusType status) {
this.status = status;
}
public String getServiceName() {
return serviceName;
}
public void setServiceName(String serviceName) {
this.serviceName = serviceName;
}
@Override
public String toString() {
return "RunningJob [" + (jobId != null ? "jobId=" + jobId + ", " : "")
+ (jobName != null ? "jobName=" + jobName + ", " : "")
+ (status != null ? "status=" + status + ", " : "")
+ (message != null ? "message=" + message + ", " : "")
+ (serviceName != null ? "serviceName=" + serviceName : "")
+ "]";
}
}

View File

@ -0,0 +1,25 @@
package org.gcube.social_networking.socialnetworking.model.shared;
/**
* Enum class that specify the possible actions to take when the GCubeSocialNetworking.SHOW_STATISTICS_ACTION_OID parameter
* is found in the page url
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public enum ShowUserStatisticAction {
POSTS_MADE_BY_USER("Your recent posts"),
LIKES_MADE_BY_USER("Posts you liked"),
COMMENTS_MADE_BY_USER("Posts you commented"),
LIKES_GOT_BY_USER("Likes to your posts"),
COMMENTS_GOT_BY_USER("Replies to your posts");
private final String actionHumanFriendly;
private ShowUserStatisticAction(String s) {
actionHumanFriendly = s;
}
public String getHumanFriendlyAction() {
return this.actionHumanFriendly;
}
}

View File

@ -0,0 +1,121 @@
package org.gcube.social_networking.socialnetworking.model.shared;
import java.io.Serializable;
import java.util.HashMap;
/**
* @author Massimiliano Assante ISTI-CNR
*/
@SuppressWarnings("serial")
public class UserInfo implements Serializable {
public transient final static String USER_INFO_ATTR = "USER_INFO_ATTR";
private String username;
private String fullName;
private String avatarId;
private String emailaddress;
private String accountURL;
private boolean male;
private boolean admin;
private HashMap<String, String> ownVREs;
public UserInfo() {
super();
}
public UserInfo(String username, String fullName, String avatarId,
String emailaddress, String accountURL, boolean male,
boolean admin, HashMap<String, String> ownVREs) {
super();
this.username = username;
this.fullName = fullName;
this.avatarId = avatarId;
this.emailaddress = emailaddress;
this.accountURL = accountURL;
this.male = male;
this.admin = admin;
this.ownVREs = ownVREs;
}
public String getAccountURL() {
return accountURL;
}
public void setAccountURL(String accountURL) {
this.accountURL = accountURL;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getAvatarId() {
return avatarId;
}
public void setAvatarId(String avatarId) {
this.avatarId = avatarId;
}
public String getEmailaddress() {
return emailaddress;
}
public void setEmailaddress(String emailaddress) {
this.emailaddress = emailaddress;
}
public boolean isMale() {
return male;
}
public void setMale(boolean male) {
this.male = male;
}
public HashMap<String, String> getOwnVREs() {
return ownVREs;
}
public void setOwnVREs(HashMap<String, String> vreMap) {
this.ownVREs = vreMap;
}
public boolean isAdmin() {
return admin;
}
public void setAdmin(boolean admin) {
this.admin = admin;
}
@Override
public String toString() {
return "UserInfo [username=" + username + ", fullName=" + fullName
+ ", avatarId=" + avatarId + ", emailaddress=" + emailaddress
+ ", accountURL=" + accountURL + ", male=" + male + ", admin="
+ admin + ", ownVREs=" + ownVREs + "]";
}
}

View File

@ -0,0 +1,8 @@
package org.gcube.social_networking.socialnetworking.model.shared.exceptions;
@SuppressWarnings("serial")
public class ColumnNameNotFoundException extends Exception {
public ColumnNameNotFoundException(String message) {
super(message);
}
}

View File

@ -0,0 +1,8 @@
package org.gcube.social_networking.socialnetworking.model.shared.exceptions;
@SuppressWarnings("serial")
public class CommentIDNotFoundException extends Exception {
public CommentIDNotFoundException(String message) {
super(message);
}
}

View File

@ -0,0 +1,8 @@
package org.gcube.social_networking.socialnetworking.model.shared.exceptions;
@SuppressWarnings("serial")
public class InviteIDNotFoundException extends Exception {
public InviteIDNotFoundException(String message) {
super(message);
}
}

View File

@ -0,0 +1,8 @@
package org.gcube.social_networking.socialnetworking.model.shared.exceptions;
@SuppressWarnings("serial")
public class InviteStatusNotFoundException extends Exception {
public InviteStatusNotFoundException(String message) {
super(message);
}
}

View File

@ -0,0 +1,8 @@
package org.gcube.social_networking.socialnetworking.model.shared.exceptions;
@SuppressWarnings("serial")
public class LikeIDNotFoundException extends Exception {
public LikeIDNotFoundException(String message) {
super(message);
}
}

View File

@ -0,0 +1,8 @@
package org.gcube.social_networking.socialnetworking.model.shared.exceptions;
@SuppressWarnings("serial")
public class NotificationChannelTypeNotFoundException extends Exception {
public NotificationChannelTypeNotFoundException(String message) {
super(message);
}
}

View File

@ -0,0 +1,8 @@
package org.gcube.social_networking.socialnetworking.model.shared.exceptions;
@SuppressWarnings("serial")
public class NotificationIDNotFoundException extends Exception {
public NotificationIDNotFoundException(String message) {
super(message);
}
}

View File

@ -0,0 +1,8 @@
package org.gcube.social_networking.socialnetworking.model.shared.exceptions;
@SuppressWarnings("serial")
public class NotificationTypeNotFoundException extends Exception {
public NotificationTypeNotFoundException(String message) {
super(message);
}
}

View File

@ -0,0 +1,9 @@
package org.gcube.social_networking.socialnetworking.model.shared.exceptions;
@SuppressWarnings("serial")
public class PostIDNotFoundException extends Exception {
public PostIDNotFoundException(String message, String postId) {
super("The Post having id: " + postId + " is not present in the database: " + message);
}
}

View File

@ -0,0 +1,8 @@
package org.gcube.social_networking.socialnetworking.model.shared.exceptions;
@SuppressWarnings("serial")
public class PostTypeNotFoundException extends Exception {
public PostTypeNotFoundException(String message) {
super(message);
}
}

View File

@ -0,0 +1,8 @@
package org.gcube.social_networking.socialnetworking.model.shared.exceptions;
@SuppressWarnings("serial")
public class PrivacyLevelTypeNotFoundException extends Exception {
public PrivacyLevelTypeNotFoundException(String message) {
super(message);
}
}

View File

@ -0,0 +1,8 @@
package org.gcube.social_networking.socialnetworking.model.shared.exceptions;
@SuppressWarnings("serial")
public class TooManyRunningClustersException extends Exception {
public TooManyRunningClustersException(String message) {
super(message);
}
}