diff options
author | Vitaly Takmazov | 2018-10-24 00:31:28 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-10-24 00:34:42 +0300 |
commit | 5b88a7355c554e500199d6c233ae891459b602ac (patch) | |
tree | cca19bfa8fa75e06debf1b072e979be68035fab7 /juick-server/src/main/java/com/juick/server/api/activity/model | |
parent | 8e6d764d6bb4391532e5376c795f634ee3898872 (diff) |
Fix deserialisation and tests
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/api/activity/model')
3 files changed, 12 insertions, 4 deletions
diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/Context.java b/juick-server/src/main/java/com/juick/server/api/activity/model/Context.java index dd67fa64..544f1aa2 100644 --- a/juick-server/src/main/java/com/juick/server/api/activity/model/Context.java +++ b/juick-server/src/main/java/com/juick/server/api/activity/model/Context.java @@ -28,6 +28,8 @@ import java.util.List; @JsonSubTypes.Type(value = Image.class, name = "Image"), @JsonSubTypes.Type(value = Key.class, name = "Key"), @JsonSubTypes.Type(value = Link.class, name = "Link"), + @JsonSubTypes.Type(value = Hashtag.class, name = "Hashtag"), + @JsonSubTypes.Type(value = Mention.class, name = "Mention"), @JsonSubTypes.Type(value = Note.class, name = "Note"), @JsonSubTypes.Type(value = OrderedCollection.class, name = "OrderedCollection"), @JsonSubTypes.Type(value = OrderedCollectionPage.class, name = "OrderedCollectionPage"), diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Mention.java b/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Mention.java index dbf3bec9..bcb52d37 100644 --- a/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Mention.java +++ b/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Mention.java @@ -1,7 +1,11 @@ package com.juick.server.api.activity.model.objects; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + public class Mention extends Link { - public Mention(String href, String name) { + @JsonCreator + public Mention(@JsonProperty("href") String href, @JsonProperty("name") String name) { this.setHref(href); this.setName(name); } diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Note.java b/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Note.java index 458b925c..baad2d3b 100644 --- a/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Note.java +++ b/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Note.java @@ -1,5 +1,6 @@ package com.juick.server.api.activity.model.objects; +import com.fasterxml.jackson.annotation.JsonFormat; import com.juick.server.api.activity.model.Context; import java.util.List; @@ -8,7 +9,7 @@ public class Note extends Context { private String content; private String attributedTo; private String inReplyTo; - private Image attachment; + private List<Image> attachment; private List<String> to; private List<String> cc; @@ -28,11 +29,12 @@ public class Note extends Context { this.attributedTo = attributedTo; } - public Image getAttachment() { + @JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY) + public List<Image> getAttachment() { return attachment; } - public void setAttachment(Image attachment) { + public void setAttachment(List<Image> attachment) { this.attachment = attachment; } |