2020-03-24 19:06:56 +01:00
|
|
|
package envoy.data;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
2020-03-24 21:11:16 +01:00
|
|
|
import java.util.StringJoiner;
|
2020-03-24 19:06:56 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Project: <strong>envoy-common</strong><br>
|
|
|
|
* File: <strong>Group.java</strong><br>
|
|
|
|
* Created: <strong>24 Mar 2020</strong><br>
|
|
|
|
*
|
|
|
|
* @author Leon Hofmeister
|
|
|
|
* @since Envoy Common v0.1-beta
|
|
|
|
*/
|
|
|
|
public class Group extends Contact {
|
|
|
|
|
|
|
|
private static final long serialVersionUID = 0L;
|
|
|
|
|
|
|
|
// TODO add admins
|
2020-03-24 21:57:59 +01:00
|
|
|
private List<Long> memberIDs;
|
2020-03-24 19:06:56 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a new instance of a {@link Group}.
|
|
|
|
*
|
|
|
|
* @param id the id of this group
|
|
|
|
* @param name the name of this group
|
|
|
|
* @since Envoy Common v0.1-beta
|
|
|
|
*/
|
2020-03-24 21:57:59 +01:00
|
|
|
public Group(long id, String name) { this(id, name, new ArrayList<>()); }
|
2020-03-24 19:06:56 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a new instance of a {@link Group}.
|
|
|
|
*
|
|
|
|
* @param id the id of this group
|
|
|
|
* @param name the name of this group
|
|
|
|
* @param memberIDs the IDs of all members that should be preinitialized
|
|
|
|
* @since Envoy Common v0.1-beta
|
|
|
|
*/
|
|
|
|
public Group(long id, String name, List<Long> memberIDs) {
|
|
|
|
super(id, name);
|
|
|
|
this.memberIDs = memberIDs;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the IDs of all members of this group
|
|
|
|
* @since Envoy Common v0.1-beta
|
|
|
|
*/
|
|
|
|
public List<Long> getMemberIDs() { return memberIDs; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param memberIDs the member IDs to set
|
|
|
|
* @since Envoy Common v0.1-beta
|
|
|
|
*/
|
|
|
|
public void setMemberIDs(List<Long> memberIDs) { this.memberIDs = memberIDs; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public String toString() {
|
2020-03-24 21:11:16 +01:00
|
|
|
var joiner = new StringJoiner(",", "Group[id=", "]");
|
2020-03-25 16:33:06 +01:00
|
|
|
joiner.add("id=" + getID());
|
2020-03-24 21:11:16 +01:00
|
|
|
joiner.add("name=" + getName());
|
|
|
|
joiner.add("memberIDs=" + getMemberIDs());
|
|
|
|
return joiner.toString();
|
2020-03-24 19:06:56 +01:00
|
|
|
}
|
|
|
|
}
|