diff --git a/src/main/java/envoy/data/Contact.java b/src/main/java/envoy/data/Contact.java
index 96b703e..e7a22ed 100644
--- a/src/main/java/envoy/data/Contact.java
+++ b/src/main/java/envoy/data/Contact.java
@@ -36,7 +36,7 @@ public abstract class Contact implements Serializable {
* @return the ID of this {@link Contact}
* @since Envoy Common v0.2-alpha
*/
- public long getId() { return id; }
+ public long getID() { return id; }
/**
* @return the name of this {@link Contact}
diff --git a/src/main/java/envoy/data/Group.java b/src/main/java/envoy/data/Group.java
index 4c662cc..44f91d4 100644
--- a/src/main/java/envoy/data/Group.java
+++ b/src/main/java/envoy/data/Group.java
@@ -59,7 +59,7 @@ public class Group extends Contact {
@Override
public String toString() {
var joiner = new StringJoiner(",", "Group[id=", "]");
- joiner.add("id=" + getId());
+ joiner.add("id=" + getID());
joiner.add("name=" + getName());
joiner.add("memberIDs=" + getMemberIDs());
return joiner.toString();
diff --git a/src/main/java/envoy/data/User.java b/src/main/java/envoy/data/User.java
index be3881e..d282e29 100644
--- a/src/main/java/envoy/data/User.java
+++ b/src/main/java/envoy/data/User.java
@@ -73,7 +73,7 @@ public class User extends Contact {
}
@Override
- public String toString() { return String.format("User[id=%d,name=%s,status=%s]", getId(), getName(), status); }
+ public String toString() { return String.format("User[id=%d,name=%s,status=%s]", getID(), getName(), status); }
/**
* @return the current status of this user
diff --git a/src/main/java/envoy/event/GroupResizeEvent.java b/src/main/java/envoy/event/GroupResizeEvent.java
new file mode 100644
index 0000000..1b6d153
--- /dev/null
+++ b/src/main/java/envoy/event/GroupResizeEvent.java
@@ -0,0 +1,86 @@
+package envoy.event;
+
+import envoy.data.Contact;
+import envoy.data.Group;
+import envoy.data.User;
+
+/**
+ * Project: envoy-common
+ * File: GroupResizeEvent.java
+ * Created: 25 Mar 2020
+ *
+ * @author Leon Hofmeister
+ * @since Envoy Common v0.1-beta
+ */
+public class GroupResizeEvent extends Event {
+
+ private final long groupID;
+ private OperationType operationType;
+
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Project: envoy-common
+ * File: GroupResizeEvent.java
+ * Created: 25 Mar 2020
+ *
+ * @author Leon Hofmeister
+ * @since Envoy Common v0.1-beta
+ */
+ public enum OperationType {
+ /**
+ *
+ */
+ ADD,
+ /**
+ *
+ */
+ REMOVE
+ }
+
+ /**
+ * Initializes a {@link GroupResizeEvent} through a Contact where the name has
+ * already been set.
+ *
+ * @param user the {@link User} who wants to join or leave a group
+ * @param group the {@link Group} he wants to join or leave
+ * @param operationType whether the user should be removed from this group. If
+ * false,
+ * this user will be added
+ * @since Envoy Common v0.2-alpha
+ */
+ public GroupResizeEvent(User user, Group group, OperationType operationType) {
+ super(user.getID());
+ if (group.getMemberIDs().contains(user.getID())) {
+ if (operationType.equals(OperationType.ADD)) throw new IllegalStateException(
+ "Cannot add " + user + " to group " + group.getID() + " because he is already a member of this group");
+ } else if (operationType.equals(OperationType.REMOVE))
+ throw new IllegalStateException("Cannot remove " + user + " from group " + group.getID() + " because he is no part of this group");
+ groupID = group.getID();
+ this.operationType = operationType;
+ }
+
+ /**
+ * @return the ID of the {@link Contact} this event is related to
+ * @since Envoy Common v0.2-alpha
+ */
+ public long getGroupId() { return groupID; }
+
+ /**
+ * @return the operationType
+ * @since Envoy Common v0.1-beta
+ */
+ public OperationType getOperationType() { return operationType; }
+
+ /**
+ * @param operationType the operationType to set
+ * @since Envoy Common v0.1-beta
+ */
+ public void setOperationType(OperationType operationType) { this.operationType = operationType; }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() { return String.format("GroupResizeEvent[userid=%d,groupid=%d,operationType=%b]", get(), groupID, operationType); }
+}
\ No newline at end of file
diff --git a/src/main/java/envoy/event/NameChangeEvent.java b/src/main/java/envoy/event/NameChangeEvent.java
new file mode 100644
index 0000000..4cfa640
--- /dev/null
+++ b/src/main/java/envoy/event/NameChangeEvent.java
@@ -0,0 +1,52 @@
+package envoy.event;
+
+import envoy.data.Contact;
+
+/**
+ * This event informs
+ * a) the server of the name change of a user or a group.
+ * b) another user of this users name change.
+ *
+ * Project: envoy-common
+ * File: NameChangeEvent.java
+ * Created: 25 Mar 2020
+ *
+ * @author Leon Hofmeister
+ * @since Envoy Common v0.1-beta
+ */
+public class NameChangeEvent extends Event {
+
+ private static final long serialVersionUID = 0L;
+ private final long id;
+
+ /**
+ * Creates a new {@link NameChangeEvent} for a user or a group.
+ *
+ * @param contactID the id of the {@link Contact} who wishes to change his name
+ * @param newName the new name of this contact
+ * @since Envoy Common v0.1-beta
+ */
+ public NameChangeEvent(long contactID, String newName) {
+ super(newName);
+ id = contactID;
+ }
+
+ /**
+ * Initializes a {@link NameChangeEvent} through a Contact where the name has
+ * already been set.
+ *
+ * @param contact the contact whose name was updated
+ * @since Envoy Common v0.2-alpha
+ */
+ public NameChangeEvent(Contact contact) { this(contact.getID(), contact.getName()); }
+
+ /**
+ * @return the ID of the {@link Contact} this event is related to
+ * @since Envoy Common v0.2-alpha
+ */
+ public long getId() { return id; }
+
+ @Override
+ public String toString() { return String.format("NameChangeEvent[id=%d,name=%s]", id, value); }
+
+}
diff --git a/src/main/java/envoy/event/UserStatusChangeEvent.java b/src/main/java/envoy/event/UserStatusChangeEvent.java
index 8349653..8ab198c 100644
--- a/src/main/java/envoy/event/UserStatusChangeEvent.java
+++ b/src/main/java/envoy/event/UserStatusChangeEvent.java
@@ -36,7 +36,7 @@ public class UserStatusChangeEvent extends Event {
* @param user the User from which to build the event
* @since Envoy Common v0.2-alpha
*/
- public UserStatusChangeEvent(User user) { this(user.getId(), user.getStatus()); }
+ public UserStatusChangeEvent(User user) { this(user.getID(), user.getStatus()); }
/**
* @return the ID of the {@link User} this event is related to