From bcc747ee5f7c233374bb95068ec185c89f42fcdb Mon Sep 17 00:00:00 2001 From: Pierre Date: Mon, 9 Apr 2018 18:42:48 +0200 Subject: [PATCH] Created Notif object --- .../client/data/notifications/Notif.java | 133 ++++++++++++++++++ .../data/notifications/NotifElemType.java | 42 ++++++ .../data/notifications/NotificationTypes.java | 42 ++++++ .../notifications/NotificationVisibility.java | 22 +++ 4 files changed, 239 insertions(+) create mode 100644 app/src/main/java/org/communiquons/android/comunic/client/data/notifications/Notif.java create mode 100644 app/src/main/java/org/communiquons/android/comunic/client/data/notifications/NotifElemType.java create mode 100644 app/src/main/java/org/communiquons/android/comunic/client/data/notifications/NotificationTypes.java create mode 100644 app/src/main/java/org/communiquons/android/comunic/client/data/notifications/NotificationVisibility.java diff --git a/app/src/main/java/org/communiquons/android/comunic/client/data/notifications/Notif.java b/app/src/main/java/org/communiquons/android/comunic/client/data/notifications/Notif.java new file mode 100644 index 0000000..09951fc --- /dev/null +++ b/app/src/main/java/org/communiquons/android/comunic/client/data/notifications/Notif.java @@ -0,0 +1,133 @@ +package org.communiquons.android.comunic.client.data.notifications; + +/** + * Notification object + * + * @author Pierre HUBERT + * Created by pierre on 4/9/18. + */ + +public class Notif { + + //Private fields + private int id; + private int time_create; + private boolean seen; + private int from_user_id; + private int dest_user_id; + private int on_elem_id; + private NotifElemType on_elem_type; + private NotificationTypes type; + private NotificationVisibility visibility; + private int from_container_id; + private NotifElemType from_container_type; + + //Get and set notification ID + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + + //Get and set notification creation time + public int getTime_create() { + return time_create; + } + + public void setTime_create(int time_create) { + this.time_create = time_create; + } + + + //Get and set seen state of the notification + public boolean isSeen() { + return seen; + } + + public void setSeen(boolean seen) { + this.seen = seen; + } + + + //Get and set source user ID + public int getFrom_user_id() { + return from_user_id; + } + + public void setFrom_user_id(int from_user_id) { + this.from_user_id = from_user_id; + } + + + //Get and set destination user id + public int getDest_user_id() { + return dest_user_id; + } + + public void setDest_user_id(int dest_user_id) { + this.dest_user_id = dest_user_id; + } + + + //Get and set on element id + public int getOn_elem_id() { + return on_elem_id; + } + + public void setOn_elem_id(int on_elem_id) { + this.on_elem_id = on_elem_id; + } + + + //Get and set on elem type + public NotifElemType getOn_elem_type() { + return on_elem_type; + } + + public void setOn_elem_type(NotifElemType on_elem_type) { + this.on_elem_type = on_elem_type; + } + + + //Get and set notification type + public NotificationTypes getType() { + return type; + } + + public void setType(NotificationTypes type) { + this.type = type; + } + + + //Get and set notification visibility + public NotificationVisibility getVisibility() { + return visibility; + } + + public void setVisibility(NotificationVisibility visibility) { + this.visibility = visibility; + } + + + //Get and set source container id + public int getFrom_container_id() { + return from_container_id; + } + + public void setFrom_container_id(int from_container_id) { + this.from_container_id = from_container_id; + } + + + //Get and set the type of the source container + public NotifElemType getFrom_container_type() { + return from_container_type; + } + + public void setFrom_container_type(NotifElemType from_container_type) { + this.from_container_type = from_container_type; + } +} diff --git a/app/src/main/java/org/communiquons/android/comunic/client/data/notifications/NotifElemType.java b/app/src/main/java/org/communiquons/android/comunic/client/data/notifications/NotifElemType.java new file mode 100644 index 0000000..2ce33e2 --- /dev/null +++ b/app/src/main/java/org/communiquons/android/comunic/client/data/notifications/NotifElemType.java @@ -0,0 +1,42 @@ +package org.communiquons.android.comunic.client.data.notifications; + +/** + * Notifications elements type + * + * @author Pierre HUBERT + * Created by pierre on 4/9/18. + */ + +public enum NotifElemType { + + /** + * On a post + */ + POST, + + /** + * On a conversation + */ + CONVERSATION, + + /** + * On a conversation message + */ + CONVERSATION_MESSAGE, + + /** + * On a user page + */ + USER_PAGE, + + /** + * On a comment + */ + COMMENT, + + /** + * On a friendship request + */ + FRIEND_REQUEST + +} diff --git a/app/src/main/java/org/communiquons/android/comunic/client/data/notifications/NotificationTypes.java b/app/src/main/java/org/communiquons/android/comunic/client/data/notifications/NotificationTypes.java new file mode 100644 index 0000000..b3bcd2b --- /dev/null +++ b/app/src/main/java/org/communiquons/android/comunic/client/data/notifications/NotificationTypes.java @@ -0,0 +1,42 @@ +package org.communiquons.android.comunic.client.data.notifications; + +/** + * Enum of the notifications types + * + * @author Pierre HUBERT + * Created by pierre on 4/9/18. + */ + +public enum NotificationTypes { + + /** + * When a comment was created + */ + COMMENT_CREATED, + + /** + * When a friendship request was sent + */ + SENT_FRIEND_REQUEST, + + /** + * When a friendship request was accepted + */ + ACCEPTED_FRIEND_REQUEST, + + /** + * When a friend request was rejected + */ + REJECTED_FRIEND_REQUEST, + + /** + * When an elem has been created + */ + ELEM_CREATED, + + /** + * When an element is updated + */ + ELEM_UPDATED + +} diff --git a/app/src/main/java/org/communiquons/android/comunic/client/data/notifications/NotificationVisibility.java b/app/src/main/java/org/communiquons/android/comunic/client/data/notifications/NotificationVisibility.java new file mode 100644 index 0000000..6d1e72f --- /dev/null +++ b/app/src/main/java/org/communiquons/android/comunic/client/data/notifications/NotificationVisibility.java @@ -0,0 +1,22 @@ +package org.communiquons.android.comunic.client.data.notifications; + +/** + * Notifications visibility enum + * + * @author Pierre HUBERT + * Created by pierre on 4/9/18. + */ + +public enum NotificationVisibility { + + /** + * When the notification is targeting only one single user + */ + EVENT_PRIVATE, + + /** + * When a notification is targeting several users + */ + EVENT_PUBLIC + +}