Move Envoy Common to common/ subdirectory
This commit is contained in:
28
common/src/main/java/envoy/event/ElementOperation.java
Normal file
28
common/src/main/java/envoy/event/ElementOperation.java
Normal file
@ -0,0 +1,28 @@
|
||||
package envoy.event;
|
||||
|
||||
/**
|
||||
* This enum declares all modification possibilities for a given container.<br>
|
||||
* These can be: {@link ElementOperation#ADD} or
|
||||
* {@link ElementOperation#REMOVE}.<br>
|
||||
* <br>
|
||||
* Project: <strong>envoy-common</strong><br>
|
||||
* File: <strong>ElementOperation.java</strong><br>
|
||||
* Created: <strong>25 Mar 2020</strong><br>
|
||||
*
|
||||
* @author Leon Hofmeister
|
||||
* @since Envoy Common v0.1-beta
|
||||
*/
|
||||
public enum ElementOperation {
|
||||
|
||||
/**
|
||||
* Select this element, if the given element should be added to the given
|
||||
* container.
|
||||
*/
|
||||
ADD,
|
||||
|
||||
/**
|
||||
* Select this element, if the given element should be removed from the given
|
||||
* container.
|
||||
*/
|
||||
REMOVE
|
||||
}
|
49
common/src/main/java/envoy/event/Event.java
Normal file
49
common/src/main/java/envoy/event/Event.java
Normal file
@ -0,0 +1,49 @@
|
||||
package envoy.event;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Project: <strong>envoy-common</strong><br>
|
||||
* File: <strong>Event.java</strong><br>
|
||||
* Created: <strong>04.12.2019</strong><br>
|
||||
*
|
||||
* @author Kai S. K. Engelbart
|
||||
* @param <T> the type of the Event
|
||||
* @since Envoy v0.2-alpha
|
||||
*/
|
||||
public abstract class Event<T> implements Serializable {
|
||||
|
||||
protected final T value;
|
||||
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
protected Event(T value) { this.value = value; }
|
||||
|
||||
/**
|
||||
* @return the data associated with this event
|
||||
*/
|
||||
public T get() { return value; }
|
||||
|
||||
@Override
|
||||
public String toString() { return String.format("%s[value=%s]", this.getClass().getSimpleName(), value); }
|
||||
|
||||
/**
|
||||
* Serves as a super class for events that do not carry a value.<br>
|
||||
* <br>
|
||||
* Project: <strong>envoy-common</strong><br>
|
||||
* File: <strong>Event.java</strong><br>
|
||||
* Created: <strong>11 Feb 2020</strong><br>
|
||||
*
|
||||
* @author Kai S. K. Engelbart
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public static abstract class Valueless extends Event<Void> {
|
||||
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
protected Valueless() { super(null); }
|
||||
|
||||
@Override
|
||||
public String toString() { return this.getClass().getSimpleName(); }
|
||||
}
|
||||
}
|
83
common/src/main/java/envoy/event/EventBus.java
Normal file
83
common/src/main/java/envoy/event/EventBus.java
Normal file
@ -0,0 +1,83 @@
|
||||
package envoy.event;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* This class handles events by allowing event handlers to register themselves
|
||||
* and then be notified about certain events dispatched by the event bus.<br>
|
||||
* <br>
|
||||
* The event bus is a singleton and can be used across the entire application to
|
||||
* guarantee the propagation of events.<br>
|
||||
* <br>
|
||||
* Project: <strong>envoy-common</strong><br>
|
||||
* File: <strong>EventBus.java</strong><br>
|
||||
* Created: <strong>04.12.2019</strong><br>
|
||||
*
|
||||
* @author Kai S. K. Engelbart
|
||||
* @since Envoy v0.2-alpha
|
||||
*/
|
||||
public class EventBus {
|
||||
|
||||
/**
|
||||
* Contains all event handler instances registered at this event bus as values
|
||||
* mapped to by their supported event classes.
|
||||
*/
|
||||
private Map<Class<? extends Event<?>>, List<Consumer<Event<?>>>> handlers = new HashMap<>();
|
||||
|
||||
/**
|
||||
* The singleton instance of this event bus that is used across the
|
||||
* entire application.
|
||||
*/
|
||||
private static EventBus eventBus = new EventBus();
|
||||
|
||||
/**
|
||||
* This constructor is not accessible from outside this class because a
|
||||
* singleton instance of it is provided by the {@link EventBus#getInstance()}
|
||||
* method.
|
||||
*/
|
||||
private EventBus() {}
|
||||
|
||||
/**
|
||||
* @return the singleton instance of the event bus
|
||||
* @since Envoy v0.2-alpha
|
||||
*/
|
||||
public static EventBus getInstance() { return eventBus; }
|
||||
|
||||
/**
|
||||
* Registers an event handler to be notified when an
|
||||
* event of a certain type is dispatched.
|
||||
*
|
||||
* @param <T> the type of event values to notify the handler about
|
||||
* @param eventClass the class which the event handler is subscribing to
|
||||
* @param handler the event handler to register
|
||||
* @since Envoy v0.2-alpha
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends Event<?>> void register(Class<T> eventClass, Consumer<T> handler) {
|
||||
if (!handlers.containsKey(eventClass)) handlers.put(eventClass, new ArrayList<>());
|
||||
handlers.get(eventClass).add((Consumer<Event<?>>) handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatches an event to every event handler subscribed to it.
|
||||
*
|
||||
* @param event the {@link Event} to dispatch
|
||||
* @since Envoy v0.2-alpha
|
||||
*/
|
||||
public void dispatch(Event<?> event) {
|
||||
handlers.keySet()
|
||||
.stream()
|
||||
.filter(event.getClass()::equals)
|
||||
.map(handlers::get)
|
||||
.flatMap(List::stream)
|
||||
.forEach(h -> h.accept(event));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a map of all event handler instances currently registered at this
|
||||
* event bus with the event classes they are subscribed to as keys
|
||||
* @since Envoy v0.2-alpha
|
||||
*/
|
||||
public Map<Class<? extends Event<?>>, List<Consumer<Event<?>>>> getHandlers() { return handlers; }
|
||||
}
|
42
common/src/main/java/envoy/event/GroupCreation.java
Normal file
42
common/src/main/java/envoy/event/GroupCreation.java
Normal file
@ -0,0 +1,42 @@
|
||||
package envoy.event;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import envoy.data.User;
|
||||
|
||||
/**
|
||||
* This event creates a group with the given name.<br>
|
||||
* <br>
|
||||
* Project: <strong>envoy-common</strong><br>
|
||||
* File: <strong>GroupCreation.java</strong><br>
|
||||
* Created: <strong>25 Mar 2020</strong><br>
|
||||
*
|
||||
* @author Leon Hofmeister
|
||||
* @since Envoy Common v0.1-beta
|
||||
*/
|
||||
public class GroupCreation extends Event<String> {
|
||||
|
||||
private final Set<Long> initialMemberIDs;
|
||||
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
/**
|
||||
* @param value the name of this group at creation time
|
||||
* @param initialMemberIDs the IDs of all {@link User}s that should be group
|
||||
* members from the beginning on (excluding the creator
|
||||
* of this group)
|
||||
* @since Envoy Common v0.1-beta
|
||||
*/
|
||||
public GroupCreation(String value, Set<Long> initialMemberIDs) {
|
||||
super(value);
|
||||
this.initialMemberIDs = (initialMemberIDs != null) ? initialMemberIDs : new HashSet<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the IDs of all {@link User}s that are members from the beginning
|
||||
* (excluding the creator of this group)
|
||||
* @since Envoy Common v0.1-beta
|
||||
*/
|
||||
public Set<Long> getInitialMemberIDs() { return initialMemberIDs; }
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package envoy.event;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import envoy.data.GroupMessage;
|
||||
import envoy.data.Message.MessageStatus;
|
||||
|
||||
/**
|
||||
* Project: <strong>envoy-common</strong><br>
|
||||
* File: <strong>GroupMessageStatusChange.java</strong><br>
|
||||
* Created: <strong>18.04.2020</strong><br>
|
||||
*
|
||||
* @author Maximilian Käfer
|
||||
* @since Envoy Common v0.1-beta
|
||||
*/
|
||||
public class GroupMessageStatusChange extends MessageStatusChange {
|
||||
|
||||
private final long memberID;
|
||||
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
/**
|
||||
* Initializes a {@link GroupMessageStatusChange}.
|
||||
*
|
||||
* @param id the ID of the {@link GroupMessage} this event is related to
|
||||
* @param status the status of this specific members {@link GroupMessage}
|
||||
* @param date the date at which the MessageStatus change occurred for
|
||||
* this specific member
|
||||
* @param memberID the ID of the group member that caused the status change
|
||||
* @since Envoy Common v0.1-beta
|
||||
*/
|
||||
public GroupMessageStatusChange(long id, MessageStatus status, LocalDateTime date, long memberID) {
|
||||
super(id, status, date);
|
||||
this.memberID = memberID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the memberID which the user who sends this event has
|
||||
* @since Envoy Common v0.1-beta
|
||||
*/
|
||||
public long getMemberID() { return memberID; }
|
||||
|
||||
@Override
|
||||
public String toString() { return String.format("GroupMessageStatusChange[meta=%s,memberID=%d]", super.toString(), memberID); }
|
||||
}
|
65
common/src/main/java/envoy/event/GroupResize.java
Normal file
65
common/src/main/java/envoy/event/GroupResize.java
Normal file
@ -0,0 +1,65 @@
|
||||
package envoy.event;
|
||||
|
||||
import envoy.data.Contact;
|
||||
import envoy.data.Group;
|
||||
import envoy.data.User;
|
||||
|
||||
/**
|
||||
* This event is used to communicate changes in the group size between client
|
||||
* and server.<br>
|
||||
* Possible actions are adding or removing certain {@link User}s to or from a
|
||||
* certain {@link Group}.
|
||||
* <br>
|
||||
* Project: <strong>envoy-common</strong><br>
|
||||
* File: <strong>GroupResize.java</strong><br>
|
||||
* Created: <strong>25 Mar 2020</strong><br>
|
||||
*
|
||||
* @author Leon Hofmeister
|
||||
* @since Envoy Common v0.1-beta
|
||||
*/
|
||||
public class GroupResize extends Event<User> {
|
||||
|
||||
private final long groupID;
|
||||
private final ElementOperation operation;
|
||||
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
/**
|
||||
* Initializes a {@link GroupResize} 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 operation describes what to do with the given user:<br>
|
||||
* add him to this group or remove him from it
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public GroupResize(User user, Group group, ElementOperation operation) {
|
||||
super(user);
|
||||
if (group.getContacts().contains(user)) {
|
||||
if (operation.equals(ElementOperation.ADD)) throw new IllegalArgumentException(
|
||||
"Cannot add " + user + " to group " + group.getID() + " because he is already a member of this group");
|
||||
} else if (operation.equals(ElementOperation.REMOVE))
|
||||
throw new IllegalArgumentException("Cannot remove " + user + " from group " + group.getID() + " because he is no part of this group");
|
||||
groupID = group.getID();
|
||||
this.operation = operation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 ElementOperation getOperation() { return operation; }
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String toString() { return String.format("GroupResize[userid=%d,groupid=%d,operation=%s]", get(), groupID, operation); }
|
||||
}
|
63
common/src/main/java/envoy/event/HandshakeRejection.java
Normal file
63
common/src/main/java/envoy/event/HandshakeRejection.java
Normal file
@ -0,0 +1,63 @@
|
||||
package envoy.event;
|
||||
|
||||
/**
|
||||
* Signifies to the client that the handshake failed for the attached
|
||||
* reason.
|
||||
* <p>
|
||||
* Project: <strong>envoy-common</strong><br>
|
||||
* File: <strong>HandshakeRejection.java</strong><br>
|
||||
* Created: <strong>28 Jan 2020</strong><br>
|
||||
*
|
||||
* @author Kai S. K. Engelbart
|
||||
* @since Envoy Common v0.3-alpha
|
||||
*/
|
||||
public class HandshakeRejection extends Event<String> {
|
||||
|
||||
/**
|
||||
* Select this value if a given password hash or user name was incorrect.
|
||||
*
|
||||
* @since Envoy Common v0.3-alpha
|
||||
*/
|
||||
public static final String WRONG_PASSWORD_OR_USER = "Incorrect user name or password.";
|
||||
|
||||
/**
|
||||
* Select this value if a given user name for a registration is already taken.
|
||||
*
|
||||
* @since Envoy Common v0.1-beta
|
||||
*/
|
||||
public static final String USERNAME_TAKEN = "Incorrect user name or password.";
|
||||
|
||||
/**
|
||||
* Select this value if the version of the client is incompatible with the
|
||||
* server.
|
||||
*
|
||||
* @since Envoy Common v0.1-beta
|
||||
*/
|
||||
public static final String WRONG_VERSION = "Incompatible client version";
|
||||
|
||||
/**
|
||||
* Select this value if the handshake could not be completed for some different
|
||||
* reason.
|
||||
*
|
||||
* @since Envoy Common v0.3-alpha
|
||||
*/
|
||||
public static final String INTERNAL_ERROR = "An internal error occured.";
|
||||
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
/**
|
||||
* Creates an instance of {@link HandshakeRejection} with the generic
|
||||
* {@link HandshakeRejection#INTERNAL_ERROR} reason.
|
||||
*
|
||||
* @since Envoy Common v0.3-alpha
|
||||
*/
|
||||
public HandshakeRejection() { super(INTERNAL_ERROR); }
|
||||
|
||||
/**
|
||||
* Creates an instance of {@link HandshakeRejection}.
|
||||
*
|
||||
* @param reason the reason why the handshake was rejected
|
||||
* @since Envoy Common v0.3-alpha
|
||||
*/
|
||||
public HandshakeRejection(String reason) { super(reason); }
|
||||
}
|
17
common/src/main/java/envoy/event/IDGeneratorRequest.java
Normal file
17
common/src/main/java/envoy/event/IDGeneratorRequest.java
Normal file
@ -0,0 +1,17 @@
|
||||
package envoy.event;
|
||||
|
||||
/**
|
||||
* Signifies to the server that the client needs a new
|
||||
* {@link envoy.data.IDGenerator} instance.<br>
|
||||
* <br>
|
||||
* Project: <strong>envoy-common</strong><br>
|
||||
* File: <strong>IDGeneratorRequest.java</strong><br>
|
||||
* Created: <strong>28 Jan 2020</strong><br>
|
||||
*
|
||||
* @author Kai S. K. Engelbart
|
||||
* @since Envoy Common v0.3-alpha
|
||||
*/
|
||||
public class IDGeneratorRequest extends Event.Valueless {
|
||||
|
||||
private static final long serialVersionUID = 1431107413883364583L;
|
||||
}
|
59
common/src/main/java/envoy/event/MessageStatusChange.java
Normal file
59
common/src/main/java/envoy/event/MessageStatusChange.java
Normal file
@ -0,0 +1,59 @@
|
||||
package envoy.event;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import envoy.data.Message;
|
||||
|
||||
/**
|
||||
* Project: <strong>envoy-common</strong><br>
|
||||
* File: <strong>MessageStatusChange.java</strong><br>
|
||||
* Created: <strong>6 Jan 2020</strong><br>
|
||||
*
|
||||
* @author Kai S. K. Engelbart
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public class MessageStatusChange extends Event<Message.MessageStatus> {
|
||||
|
||||
private final long id;
|
||||
private final LocalDateTime date;
|
||||
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
/**
|
||||
* Initializes a {@link MessageStatusChange}.
|
||||
*
|
||||
* @param id the ID of the {@link Message} this event is related to
|
||||
* @param status the status of the {@link Message} this event is related
|
||||
* to
|
||||
* @param date the date at which the MessageStatus change occurred
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public MessageStatusChange(long id, Message.MessageStatus status, LocalDateTime date) {
|
||||
super(status);
|
||||
this.id = id;
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a {@link MessageStatusChange} through a message.
|
||||
*
|
||||
* @param message the message from which to build the event
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public MessageStatusChange(Message message) { this(message.getID(), message.getStatus(), LocalDateTime.now()); }
|
||||
|
||||
/**
|
||||
* @return the ID of the {@link Message} this event is related to
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public long getID() { return id; }
|
||||
|
||||
/**
|
||||
* @return the date at which the status change occurred
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public LocalDateTime getDate() { return date; }
|
||||
|
||||
@Override
|
||||
public String toString() { return String.format("MessageStatusChange[id=%d,status=%s,date=%s]", id, value, date); }
|
||||
}
|
52
common/src/main/java/envoy/event/NameChange.java
Normal file
52
common/src/main/java/envoy/event/NameChange.java
Normal file
@ -0,0 +1,52 @@
|
||||
package envoy.event;
|
||||
|
||||
import envoy.data.Contact;
|
||||
|
||||
/**
|
||||
* This event informs<br>
|
||||
* a) the server of the name change of a user or a group.
|
||||
* b) another user of this users name change.
|
||||
*
|
||||
* Project: <strong>envoy-common</strong><br>
|
||||
* File: <strong>NameChange.java</strong><br>
|
||||
* Created: <strong>25 Mar 2020</strong><br>
|
||||
*
|
||||
* @author Leon Hofmeister
|
||||
* @since Envoy Common v0.1-beta
|
||||
*/
|
||||
public class NameChange extends Event<String> {
|
||||
|
||||
private final long id;
|
||||
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
/**
|
||||
* Creates a new {@link NameChange} 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 NameChange(long contactID, String newName) {
|
||||
super(newName);
|
||||
id = contactID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a {@link NameChange} 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 NameChange(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("NameChange[id=%d,name=%s]", id, value); }
|
||||
}
|
49
common/src/main/java/envoy/event/UserStatusChange.java
Normal file
49
common/src/main/java/envoy/event/UserStatusChange.java
Normal file
@ -0,0 +1,49 @@
|
||||
package envoy.event;
|
||||
|
||||
import envoy.data.User;
|
||||
import envoy.data.User.UserStatus;
|
||||
|
||||
/**
|
||||
* Project: <strong>envoy-common</strong><br>
|
||||
* File: <strong>UserStatusChange.java</strong><br>
|
||||
* Created: <strong>1 Feb 2020</strong><br>
|
||||
*
|
||||
* @author Leon Hofmeister
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public class UserStatusChange extends Event<UserStatus> {
|
||||
|
||||
private final long id;
|
||||
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
/**
|
||||
* Initializes a {@link UserStatusChange}.
|
||||
*
|
||||
* @param id the ID of the {@link User} this event is related to
|
||||
* @param status the status of the {@link User} this event is related
|
||||
* to
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public UserStatusChange(long id, User.UserStatus status) {
|
||||
super(status);
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a {@link UserStatusChange} through a User.
|
||||
*
|
||||
* @param user the User from which to build the event
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public UserStatusChange(User user) { this(user.getID(), user.getStatus()); }
|
||||
|
||||
/**
|
||||
* @return the ID of the {@link User} this event is related to
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public long getID() { return id; }
|
||||
|
||||
@Override
|
||||
public String toString() { return String.format("UserStatusChange[id=%d,status=%s]", id, value); }
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package envoy.event.contact;
|
||||
|
||||
import envoy.data.Contact;
|
||||
import envoy.event.ElementOperation;
|
||||
import envoy.event.Event;
|
||||
|
||||
/**
|
||||
* Signifies the modification of a contact list.<br>
|
||||
* <br>
|
||||
* Project: <strong>envoy-common</strong><br>
|
||||
* File: <strong>ContactOperation.java</strong><br>
|
||||
* Created: <strong>05.02.2020</strong><br>
|
||||
*
|
||||
* @author Maximilian Käfer
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public class ContactOperation extends Event<Contact> {
|
||||
|
||||
private final ElementOperation operationType;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Initializes a {@link ContactOperation}.
|
||||
*
|
||||
* @param contact the user on which the operation is performed
|
||||
* @param operationType the type of operation to perform
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public ContactOperation(Contact contact, ElementOperation operationType) {
|
||||
super(contact);
|
||||
this.operationType = operationType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the type of operation to perform
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public ElementOperation getOperationType() { return operationType; }
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package envoy.event.contact;
|
||||
|
||||
import envoy.event.Event;
|
||||
|
||||
/**
|
||||
* Requests a contact search from the server.<br>
|
||||
* <br>
|
||||
* Project: <strong>envoy-common</strong><br>
|
||||
* File: <strong>ContactSearchRequest.java</strong><br>
|
||||
* Created: <strong>05.02.2020</strong><br>
|
||||
*
|
||||
* @author Maximilian Käfer
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public class ContactSearchRequest extends Event<String> {
|
||||
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
/**
|
||||
* Initializes a {@link ContactSearchRequest}.
|
||||
*
|
||||
* @param searchPhrase the search phrase to use in the contact search
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public ContactSearchRequest(String searchPhrase) { super(searchPhrase); }
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package envoy.event.contact;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import envoy.data.Contact;
|
||||
import envoy.event.Event;
|
||||
|
||||
/**
|
||||
* Contains a list of {@link Contact}s for which a search was performed.<br>
|
||||
* <br>
|
||||
* Project: <strong>envoy-common</strong><br>
|
||||
* File: <strong>ContactSearchResult.java</strong><br>
|
||||
* Created: <strong>11 Feb 2020</strong><br>
|
||||
*
|
||||
* @author Kai S. K. Engelbart
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public class ContactSearchResult extends Event<List<Contact>> {
|
||||
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
/**
|
||||
* Creates an instance of {@link ContactSearchResult}.
|
||||
*
|
||||
* @param users the users found during the search
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public ContactSearchResult(List<Contact> users) { super(users); }
|
||||
}
|
13
common/src/main/java/envoy/event/contact/package-info.java
Normal file
13
common/src/main/java/envoy/event/contact/package-info.java
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* This package contains all contact-related events.<br>
|
||||
* <br>
|
||||
* Project: <strong>envoy-common</strong><br>
|
||||
* File: <strong>package-info.java</strong><br>
|
||||
* Created: <strong>28 Mar 2020</strong><br>
|
||||
*
|
||||
* @author Leon Hofmeister
|
||||
* @author Maximilian Käfer
|
||||
* @author Kai S.K. Engelbart
|
||||
* @since Envoy Common v0.1-beta
|
||||
*/
|
||||
package envoy.event.contact;
|
10
common/src/main/java/envoy/event/package-info.java
Normal file
10
common/src/main/java/envoy/event/package-info.java
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* This package contains all events that can be sent or received by Envoy Client
|
||||
* or Envoy Server Standalone.
|
||||
*
|
||||
* @author Leon Hofmeister
|
||||
* @author Maximilian Käfer
|
||||
* @author Kai S.K. Engelbart
|
||||
* @since Envoy common v0.1-beta
|
||||
*/
|
||||
package envoy.event;
|
Reference in New Issue
Block a user