From 1a2830588131173d8fbfeb1fe03c466b4cf30e46 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 30 Nov 2016 16:49:11 +0300 Subject: juick-core: fix attachment serialization --- juick-core/src/main/java/com/juick/Message.java | 33 +++++++++++++++++++------ 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'juick-core/src/main/java/com/juick/Message.java') diff --git a/juick-core/src/main/java/com/juick/Message.java b/juick-core/src/main/java/com/juick/Message.java index b5fc2b89..d3f28e22 100644 --- a/juick-core/src/main/java/com/juick/Message.java +++ b/juick-core/src/main/java/com/juick/Message.java @@ -57,9 +57,9 @@ public class Message implements Comparable { @XmlTransient public int Replies = 0; public String RepliesBy = null; + private String attachmentType; @XmlTransient - public String AttachmentType = null; - public String Photo = null; + private Photo photo; public String Video = null; public Place Place = null; @XmlTransient @@ -87,8 +87,8 @@ public class Message implements Comparable { ReadOnly = msg.ReadOnly; Hidden = msg.Hidden; Replies = msg.Replies; - AttachmentType = msg.AttachmentType; - Photo = msg.Photo; + attachmentType = msg.attachmentType; + photo = msg.photo; Video = msg.Video; Place = msg.Place; Likes = msg.Likes; @@ -157,15 +157,16 @@ public class Message implements Comparable { } } + @JsonIgnore public String getAttachmentURL() { - if (AttachmentType != null) { + if (attachmentType != null) { String url = "http://i.juick.com/"; - url += AttachmentType.equals("mp4") ? "video" : "photos-1024"; + url += attachmentType.equals("mp4") ? "video" : "photos-1024"; url += "/" + getMid(); if (getRid() > 0) { url += "-" + getRid(); } - url += "." + AttachmentType; + url += "." + attachmentType; return url; } else { return null; @@ -309,4 +310,22 @@ public class Message implements Comparable { public void setPrivacy(int privacy) { this.privacy = privacy; } + + public Photo getPhoto() { + return photo; + } + + public void setPhoto(Photo photo) { + this.photo = photo; + } + + @XmlAttribute(name = "attach") + @JsonProperty("attach") + public String getAttachmentType() { + return attachmentType; + } + + public void setAttachmentType(String attachmentType) { + this.attachmentType = attachmentType; + } } -- cgit v1.2.3