diff --git a/src/main/java/envoy/event/ContactOperation.java b/src/main/java/envoy/event/ContactOperation.java new file mode 100644 index 0000000..1a5a108 --- /dev/null +++ b/src/main/java/envoy/event/ContactOperation.java @@ -0,0 +1,50 @@ +package envoy.event; + +import envoy.data.User; + +/** + * Project: envoy-common
+ * File: ContactOperation.java
+ * Created: 05.02.2020
+ * + * @author Maximilian Käfer + * @since Envoy Common v0.2-alpha + */ +public class ContactOperation implements Event { + + public enum Operation { + ADD, REMOVE; + } + + private final User contact; + private final Operation operationType; + + private static final long serialVersionUID = -1166652868189511553L; + + /** + * Initializes a {@link ContacsOperation}. + * + * @param operationType the {@link Operation} which should be executed on the + * {@link contact}. + * @since Envoy Common v0.2-alpha + */ + public ContactOperation(User contact, Operation operationType) { + this.contact = contact; + this.operationType = operationType; + } + + /** + * @return the {@link User}, which should be added/removed from the contacts + * list. + * @since Envoy Common v0.2-alpha + */ + @Override + public User get() { return contact; } + + /** + * @return the {@link Operation}, which should be executed with the contact, + * this event corresponds with. + * @since Envoy Common v0.2-alpha + */ + public Operation getOperationType() { return operationType; } +} diff --git a/src/main/java/envoy/event/ContactsRequest.java b/src/main/java/envoy/event/ContactsRequest.java new file mode 100644 index 0000000..04abcfd --- /dev/null +++ b/src/main/java/envoy/event/ContactsRequest.java @@ -0,0 +1,32 @@ +package envoy.event; + +/** + * Project: envoy-common
+ * File: ContactsRequest.java
+ * Created: 05.02.2020
+ * + * @author Maximilian Käfer + * @since Envoy Common v0.2-alpha + */ +public class ContactsRequest implements Event { + + private final String request; + + private static final long serialVersionUID = -7969312055630533627L; + + /** + * Initializes a {@link ContactsRequest}. + * + * @param request the string, which is entered by the client to request + * corresponding clients as contacts from the server. + * @since Envoy Common v0.2-alpha + */ + public ContactsRequest(String request) { this.request = request; } + + /** + * @return the request string + * @since Envoy Common v0.2-alpha + */ + @Override + public String get() { return request; } +}