package com.juick.server.api; import com.juick.Message; import com.juick.User; import java.util.List; public class SystemActivity { public static SystemActivity like(User from, Message message, List subscribers) { var like = new SystemActivity(); like.setType(ActivityType.like); like.setFrom(from); like.setMessage(message); like.setTo(subscribers); return like; } public static SystemActivity message(User from, Message message, List subscribers) { var msg = new SystemActivity(); msg.setType(ActivityType.message); msg.setFrom(from); msg.setMessage(message); msg.setTo(subscribers); return msg; } public static SystemActivity read(User from, Message message) { var read = new SystemActivity(); read.setType(ActivityType.message); read.setFrom(from); var msg = new Message(); msg.setMid(message.getMid()); msg.setService(true); msg.setUnread(false); read.setMessage(msg); return read; } public static SystemActivity follow(User from, List to) { var follow = new SystemActivity(); follow.setFrom(from); follow.setTo(to); return follow; } public enum ActivityType { message, like, follow } private ActivityType type; private User from; private List to; private Message message; public ActivityType getType() { return type; } public void setType(ActivityType type) { this.type = type; } public User getFrom() { return from; } public void setFrom(User from) { this.from = from; } public List getTo() { return to; } public void setTo(List to) { this.to = to; } public Message getMessage() { return message; } public void setMessage(Message message) { this.message = message; } }