aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/Message.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/Message.java')
-rw-r--r--src/main/java/com/juick/Message.java40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/main/java/com/juick/Message.java b/src/main/java/com/juick/Message.java
index 10380826..2035d4c6 100644
--- a/src/main/java/com/juick/Message.java
+++ b/src/main/java/com/juick/Message.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2017, Juick
+ * Copyright (C) 2008-2019, Juick
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -21,15 +21,15 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.juick.adapters.SimpleDateAdapter;
import com.juick.model.Entity;
-import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
+import javax.annotation.Nonnull;
import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.net.URI;
import java.time.Instant;
-import java.util.ArrayList;
import java.util.HashSet;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
@@ -45,8 +45,8 @@ public class Message implements Comparable {
private int replyto = 0;
private String text = null;
private User user = null;
- private final List<Tag> tags;
- private Instant ts;
+ private Set<Tag> tags;
+ private Instant created;
private Instant updated;
private Instant updatedAt;
private boolean unread;
@@ -81,12 +81,12 @@ public class Message implements Comparable {
private URI replyToUri;
private boolean html;
- private Set<String> recommendations;
+ private Set<User> recommendations;
private List<Entity> entities;
public Message() {
- tags = new ArrayList<>();
+ tags = new LinkedHashSet<>();
reactions = new HashSet<>();
}
@@ -120,7 +120,7 @@ public class Message implements Comparable {
}
@Override
- public int compareTo(Object obj) throws ClassCastException {
+ public int compareTo(@Nonnull Object obj) throws ClassCastException {
if (obj == this)
return 0;
@@ -180,15 +180,15 @@ public class Message implements Comparable {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "UTC")
@XmlAttribute(name = "ts")
@XmlJavaTypeAdapter(SimpleDateAdapter.class)
- public Instant getTimestamp() {
- return ts;
+ public Instant getCreated() {
+ return created;
}
- public void setTimestamp(Instant timestamp) {
- this.ts = timestamp;
+ public void setCreated(Instant timestamp) {
+ this.created = timestamp;
}
- @XmlElement(name = "to", namespace = "http://juick.com/user")
+ @XmlTransient
public User getTo() {
return to;
}
@@ -218,14 +218,12 @@ public class Message implements Comparable {
@JsonProperty("tags")
@XmlElement(name = "tag")
- public List<Tag> getTags() {
+ public Set<Tag> getTags() {
return tags;
}
- public void setTags(List<Tag> tags) {
- this.tags.clear();
- if (CollectionUtils.isNotEmpty(tags))
- this.tags.addAll(tags);
+ public void setTags(Set<Tag> tags) {
+ this.tags = tags;
}
@XmlAttribute
@@ -333,11 +331,11 @@ public class Message implements Comparable {
this.service = service;
}
- public Set<String> getRecommendations() {
+ public Set<User> getRecommendations() {
return recommendations;
}
- public void setRecommendations(Set<String> recommendations) {
+ public void setRecommendations(Set<User> recommendations) {
this.recommendations = recommendations;
}
@@ -363,6 +361,7 @@ public class Message implements Comparable {
this.replyUri = replyUri;
}
+ @XmlAttribute(name = "html")
public boolean isHtml() {
return html;
}
@@ -371,6 +370,7 @@ public class Message implements Comparable {
this.html = html;
}
+ @XmlTransient
public URI getReplyToUri() {
return replyToUri;
}