small refactor. now working

This commit is contained in:
Alfredo Oliviero 2024-05-16 18:03:49 +02:00
parent 6fe45d9827
commit d3cb7a0882
11 changed files with 64 additions and 59 deletions

View File

@ -5,7 +5,7 @@ import java.io.Serializable;
import org.jsonmaker.gwt.client.Jsonizer; import org.jsonmaker.gwt.client.Jsonizer;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class Attachment implements Serializable { public class Attachment implements Serializable, IdResource {
public interface AttachmentJsonizer extends Jsonizer {} public interface AttachmentJsonizer extends Jsonizer {}
@ -42,9 +42,11 @@ public class Attachment implements Serializable {
public String getId() { public String getId() {
return id; return id;
} }
public void setId(String id) { public void setId(String id) {
this.id = id; this.id = id;
} }
public String getUri() { public String getUri() {
return uri; return uri;
} }

View File

@ -10,7 +10,7 @@ import java.util.Date;
* *
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class Comment implements Serializable, Comparable<Comment> { public class Comment implements Serializable, Comparable<Comment>, IdResource {
private String key; private String key;
private String userid; private String userid;
@ -28,6 +28,7 @@ public class Comment implements Serializable, Comparable<Comment> {
public Comment() { public Comment() {
super(); super();
} }
/** /**
* *
* @param key * @param key
@ -55,6 +56,7 @@ public class Comment implements Serializable, Comparable<Comment> {
/** /**
* Constructor for edited comment * Constructor for edited comment
*
* @param key * @param key
* @param userid * @param userid
* @param time * @param time
@ -86,6 +88,7 @@ public class Comment implements Serializable, Comparable<Comment> {
public String getText() { public String getText() {
return text; return text;
} }
/** /**
* *
* @param text text to add as string * @param text text to add as string
@ -93,6 +96,7 @@ public class Comment implements Serializable, Comparable<Comment> {
public void setText(String text) { public void setText(String text) {
this.text = text; this.text = text;
} }
/** /**
* *
* @return the uuid * @return the uuid
@ -148,15 +152,19 @@ public class Comment implements Serializable, Comparable<Comment> {
public boolean isEdit() { public boolean isEdit() {
return isEdit; return isEdit;
} }
public void setEdit(boolean isEdit) { public void setEdit(boolean isEdit) {
this.isEdit = isEdit; this.isEdit = isEdit;
} }
public Date getLastEditTime() { public Date getLastEditTime() {
return lastEditTime; return lastEditTime;
} }
public void setLastEditTime(Date lastEditTime) { public void setLastEditTime(Date lastEditTime) {
this.lastEditTime = lastEditTime; this.lastEditTime = lastEditTime;
} }
public int compareTo(Comment toCompare) { public int compareTo(Comment toCompare) {
if (this.time.after(toCompare.getTime())) if (this.time.after(toCompare.getTime()))
return 1; return 1;
@ -172,4 +180,9 @@ public class Comment implements Serializable, Comparable<Comment> {
+ fullName + ", thumbnailURL=" + thumbnailURL + ", isEdit=" + fullName + ", thumbnailURL=" + thumbnailURL + ", isEdit="
+ isEdit + ", lastEditTime=" + lastEditTime + "]"; + isEdit + ", lastEditTime=" + lastEditTime + "]";
} }
@Override
public String getId() {
return key;
}
} }

View File

@ -3,7 +3,7 @@ package org.gcube.social_networking.socialnetworking.model.shared;
import java.io.Serializable; import java.io.Serializable;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class Hashtag extends Resource implements Serializable{ public class Hashtag implements IdResource, Serializable{
private String hashtag; private String hashtag;
private int occurrence; private int occurrence;

View File

@ -1,7 +1,6 @@
package org.gcube.social_networking.socialnetworking.model.shared; package org.gcube.social_networking.socialnetworking.model.shared;
public abstract class Resource { public interface IdResource {
public String getId();
public abstract String getId();
} }

View File

@ -2,13 +2,14 @@ package org.gcube.social_networking.socialnetworking.model.shared;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* *
* @author Massimiliano Assante, ISTI-CNR * @author Massimiliano Assante, ISTI-CNR
* *
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class Invite implements Serializable { public class Invite implements Serializable, IdResource {
private String key; private String key;
private String senderUserId; private String senderUserId;
@ -19,14 +20,15 @@ public class Invite implements Serializable {
private Date time; private Date time;
private String senderFullName; private String senderFullName;
@Override
public String getId() {
return this.key;
}
public Invite() { public Invite() {
super(); super();
} }
public Invite(String key, String senderUserId, String vreid, public Invite(String key, String senderUserId, String vreid,
String invitedEmail, String controlCode, InviteStatus status, String invitedEmail, String controlCode, InviteStatus status,
Date time, String senderFullName) { Date time, String senderFullName) {
@ -41,95 +43,70 @@ public class Invite implements Serializable {
this.senderFullName = senderFullName; this.senderFullName = senderFullName;
} }
public String getKey() { public String getKey() {
return key; return key;
} }
public void setKey(String key) { public void setKey(String key) {
this.key = key; this.key = key;
} }
public String getSenderUserId() { public String getSenderUserId() {
return senderUserId; return senderUserId;
} }
public void setSenderUserId(String senderUserId) { public void setSenderUserId(String senderUserId) {
this.senderUserId = senderUserId; this.senderUserId = senderUserId;
} }
public String getVreid() { public String getVreid() {
return vreid; return vreid;
} }
public void setVreid(String vreid) { public void setVreid(String vreid) {
this.vreid = vreid; this.vreid = vreid;
} }
public String getInvitedEmail() { public String getInvitedEmail() {
return invitedEmail; return invitedEmail;
} }
public void setInvitedEmail(String invitedEmail) { public void setInvitedEmail(String invitedEmail) {
this.invitedEmail = invitedEmail; this.invitedEmail = invitedEmail;
} }
public String getControlCode() { public String getControlCode() {
return controlCode; return controlCode;
} }
public void setControlCode(String controlCode) { public void setControlCode(String controlCode) {
this.controlCode = controlCode; this.controlCode = controlCode;
} }
public InviteStatus getStatus() { public InviteStatus getStatus() {
return status; return status;
} }
public void setStatus(InviteStatus status) { public void setStatus(InviteStatus status) {
this.status = status; this.status = status;
} }
public Date getTime() { public Date getTime() {
return time; return time;
} }
public void setTime(Date time) { public void setTime(Date time) {
this.time = time; this.time = time;
} }
public String getSenderFullName() { public String getSenderFullName() {
return senderFullName; return senderFullName;
} }
public void setSenderFullName(String senderFullName) { public void setSenderFullName(String senderFullName) {
this.senderFullName = senderFullName; this.senderFullName = senderFullName;
} }
@Override @Override
public String toString() { public String toString() {
return "Invite [key=" + key + ", senderUserId=" + senderUserId return "Invite [key=" + key + ", senderUserId=" + senderUserId
@ -138,7 +115,4 @@ public class Invite implements Serializable {
+ ", time=" + time + ", senderFullName=" + senderFullName + "]"; + ", time=" + time + ", senderFullName=" + senderFullName + "]";
} }
} }

View File

@ -9,7 +9,7 @@ import java.util.Date;
* *
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class Like implements Serializable { public class Like implements Serializable, IdResource {
private String key; private String key;
private String userid; private String userid;
@ -18,6 +18,11 @@ public class Like implements Serializable {
private String fullName; private String fullName;
private String thumbnailURL; private String thumbnailURL;
@Override
public String getId() {
return this.key;
}
public Like() { public Like() {
super(); super();
} }

View File

@ -9,7 +9,7 @@ import java.util.Date;
* *
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class Notification implements Serializable { public class Notification implements Serializable, IdResource {
private String key; private String key;
private NotificationType type; private NotificationType type;
@ -190,4 +190,11 @@ public class Notification implements Serializable {
+ senderFullName + ", senderThumbnail=" + senderThumbnail + senderFullName + ", senderThumbnail=" + senderThumbnail
+ ", commentKey=" + commentKey + "]"; + ", commentKey=" + commentKey + "]";
} }
@Override
public String getId() {
return this.key;
}
} }

View File

@ -3,7 +3,7 @@ package org.gcube.social_networking.socialnetworking.model.shared;
import java.io.Serializable; import java.io.Serializable;
import java.util.Arrays; import java.util.Arrays;
public class NotificationPreference extends Resource implements Serializable { public class NotificationPreference implements Serializable, IdResource {
private String notificationType; private String notificationType;
private String[] notificationChannelType; private String[] notificationChannelType;
@ -13,6 +13,7 @@ public class NotificationPreference extends Resource implements Serializable {
public NotificationPreference() { public NotificationPreference() {
super(); super();
} }
/** /**
* *
* @param notificationType * @param notificationType
@ -24,11 +25,10 @@ public class NotificationPreference extends Resource implements Serializable {
this.notificationChannelType = notificationChannelType; this.notificationChannelType = notificationChannelType;
} }
@Override @Override
public String toString() { public String toString() {
return "NotificationPreference [notificationtype=" + notificationType + ", notificationChannelType=" + Arrays.toString(notificationChannelType) + "]"; return "NotificationPreference [notificationtype=" + notificationType + ", notificationChannelType="
+ Arrays.toString(notificationChannelType) + "]";
} }
public String getNotificationType() { public String getNotificationType() {

View File

@ -9,7 +9,7 @@ import java.util.Date;
* *
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class Post implements Serializable, Comparable<Post> { public class Post implements Serializable, Comparable<Post>, IdResource {
private String key; private String key;
private PostType type; private PostType type;
@ -29,6 +29,10 @@ public class Post implements Serializable, Comparable<Post> {
private String linkDescription; private String linkDescription;
private String linkHost; private String linkHost;
boolean applicationPost; boolean applicationPost;
public String getId(){
return this.key;
}
/** /**
* this boolean indicates that the attachments to the post are > 1 * this boolean indicates that the attachments to the post are > 1
*/ */

View File

@ -4,10 +4,14 @@ import java.io.Serializable;
import java.util.List; import java.util.List;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PostWithAttachment implements Serializable { public class PostWithAttachment implements IdResource, Serializable{
private Post post; private Post post;
private List<Attachment> attachments; private List<Attachment> attachments;
public String getId(){
return this.post.getId();
}
public PostWithAttachment(Post post, List<Attachment> attachments){ public PostWithAttachment(Post post, List<Attachment> attachments){
super(); super();
this.post = post; this.post = post;

View File

@ -1,10 +1,9 @@
package org.gcube.social_networking.socialnetworking.model.shared; package org.gcube.social_networking.socialnetworking.model.shared;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class Vre extends Resource implements Serializable{ public class Vre implements IdResource, Serializable {
private String vreid; private String vreid;
@ -14,6 +13,7 @@ public class Vre extends Resource implements Serializable{
public Vre() { public Vre() {
super(); super();
} }
/** /**
* *
* @param vreid * @param vreid
@ -24,13 +24,11 @@ public class Vre extends Resource implements Serializable{
} }
@Override @Override
public String toString() { public String toString() {
return "Vre [vreid=" + vreid + "]"; return "Vre [vreid=" + vreid + "]";
} }
@Override @Override
public String getId() { public String getId() {
return vreid; return vreid;
@ -40,4 +38,3 @@ public class Vre extends Resource implements Serializable{
this.vreid = vreid; this.vreid = vreid;
} }
} }