From 8e6d764d6bb4391532e5376c795f634ee3898872 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 10 Oct 2018 00:09:58 +0300 Subject: ActivityPub: Mentions and Hashtags --- .../java/com/juick/server/ActivityPubManager.java | 29 +++++++- .../java/com/juick/server/KeystoreManager.java | 4 +- .../java/com/juick/server/SignatureManager.java | 2 +- .../com/juick/server/api/activity/Profile.java | 12 +-- .../juick/server/api/activity/model/Context.java | 27 ++++++- .../com/juick/server/api/activity/model/Image.java | 13 ---- .../com/juick/server/api/activity/model/Key.java | 22 ------ .../com/juick/server/api/activity/model/Link.java | 13 ---- .../com/juick/server/api/activity/model/Note.java | 60 --------------- .../api/activity/model/OrderedCollection.java | 23 ------ .../api/activity/model/OrderedCollectionPage.java | 56 -------------- .../juick/server/api/activity/model/Person.java | 86 --------------------- .../server/api/activity/model/objects/Hashtag.java | 6 ++ .../server/api/activity/model/objects/Image.java | 15 ++++ .../server/api/activity/model/objects/Key.java | 24 ++++++ .../server/api/activity/model/objects/Link.java | 15 ++++ .../server/api/activity/model/objects/Mention.java | 8 ++ .../server/api/activity/model/objects/Note.java | 62 +++++++++++++++ .../activity/model/objects/OrderedCollection.java | 25 +++++++ .../model/objects/OrderedCollectionPage.java | 58 +++++++++++++++ .../server/api/activity/model/objects/Person.java | 87 ++++++++++++++++++++++ 21 files changed, 359 insertions(+), 288 deletions(-) delete mode 100644 juick-server/src/main/java/com/juick/server/api/activity/model/Image.java delete mode 100644 juick-server/src/main/java/com/juick/server/api/activity/model/Key.java delete mode 100644 juick-server/src/main/java/com/juick/server/api/activity/model/Link.java delete mode 100644 juick-server/src/main/java/com/juick/server/api/activity/model/Note.java delete mode 100644 juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollection.java delete mode 100644 juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollectionPage.java delete mode 100644 juick-server/src/main/java/com/juick/server/api/activity/model/Person.java create mode 100644 juick-server/src/main/java/com/juick/server/api/activity/model/objects/Hashtag.java create mode 100644 juick-server/src/main/java/com/juick/server/api/activity/model/objects/Image.java create mode 100644 juick-server/src/main/java/com/juick/server/api/activity/model/objects/Key.java create mode 100644 juick-server/src/main/java/com/juick/server/api/activity/model/objects/Link.java create mode 100644 juick-server/src/main/java/com/juick/server/api/activity/model/objects/Mention.java create mode 100644 juick-server/src/main/java/com/juick/server/api/activity/model/objects/Note.java create mode 100644 juick-server/src/main/java/com/juick/server/api/activity/model/objects/OrderedCollection.java create mode 100644 juick-server/src/main/java/com/juick/server/api/activity/model/objects/OrderedCollectionPage.java create mode 100644 juick-server/src/main/java/com/juick/server/api/activity/model/objects/Person.java (limited to 'juick-server/src/main/java') diff --git a/juick-server/src/main/java/com/juick/server/ActivityPubManager.java b/juick-server/src/main/java/com/juick/server/ActivityPubManager.java index d494154c..4a6ed7be 100644 --- a/juick-server/src/main/java/com/juick/server/ActivityPubManager.java +++ b/juick-server/src/main/java/com/juick/server/ActivityPubManager.java @@ -4,9 +4,7 @@ import com.juick.Message; import com.juick.User; import com.juick.formatters.PlainTextFormatter; import com.juick.server.api.activity.model.Context; -import com.juick.server.api.activity.model.Image; -import com.juick.server.api.activity.model.Note; -import com.juick.server.api.activity.model.Person; +import com.juick.server.api.activity.model.objects.*; import com.juick.server.api.activity.model.activities.Accept; import com.juick.server.api.activity.model.activities.Announce; import com.juick.server.api.activity.model.activities.Create; @@ -31,6 +29,7 @@ import java.io.IOException; import java.net.URI; import java.util.Collections; import java.util.Optional; +import java.util.stream.Collectors; @Component public class ActivityPubManager implements ActivityListener, NotificationListener { @@ -184,6 +183,10 @@ public class ActivityPubManager implements ActivityListener, NotificationListene uri.replacePath(String.format("/n/%d-%d", mid, rid)); return uri.toUriString(); } + public String tagUri(com.juick.Tag tag) { + UriComponentsBuilder uri = UriComponentsBuilder.fromUriString(baseUri); + return uri.replacePath(String.format("/t/%s", tag.getName())).toUriString(); + } public Note makeNote(Message msg) { Note note = new Note(); @@ -204,7 +207,8 @@ public class ActivityPubManager implements ActivityListener, NotificationListene note.setCc(Collections.singletonList(followersUri(msg.getUser()))); } note.setPublished(msg.getTimestamp()); - note.setContent(msg.isHtml() ? msg.getText() : MessageUtils.formatMessage(msg.getText())); + note.setContent(msg.isHtml() ? msg.getText() + : MessageUtils.formatMessage(StringUtils.defaultString(msg.getText()))); if (StringUtils.isNotBlank(msg.getAttachmentType())) { Image attachment = new Image(); attachment.setId(msg.getAttachment().getMedium().getUrl()); @@ -212,6 +216,23 @@ public class ActivityPubManager implements ActivityListener, NotificationListene attachment.setMediaType(HttpUtils.mediaType(msg.getAttachmentType())); note.setAttachment(attachment); } + note.setTags(msg.getTags().stream().map(t -> { + Hashtag hashtag = new Hashtag(); + hashtag.setId(tagUri(t)); + hashtag.setName("#" + t.getName()); + return hashtag; + }).collect(Collectors.toList())); + if (msg.getReplyToUri().toASCIIString().length() > 0) { + Optional createContext = signatureManager.getContext(msg.getReplyToUri()); + if (createContext.isPresent()) { + Create activity = (Create) createContext.get(); + Optional personContext = signatureManager.getContext(URI.create(activity.getActor())); + if (personContext.isPresent()) { + Person person = (Person) personContext.get(); + note.getTags().add(new Mention(person.getUrl(), person.getPreferredUsername())); + } + } + } return note; } diff --git a/juick-server/src/main/java/com/juick/server/KeystoreManager.java b/juick-server/src/main/java/com/juick/server/KeystoreManager.java index 855052c4..97c3a224 100644 --- a/juick-server/src/main/java/com/juick/server/KeystoreManager.java +++ b/juick-server/src/main/java/com/juick/server/KeystoreManager.java @@ -1,6 +1,6 @@ package com.juick.server; -import com.juick.server.api.activity.model.Person; +import com.juick.server.api.activity.model.objects.Person; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; @@ -17,9 +17,7 @@ import java.security.cert.Certificate; import java.security.cert.CertificateException; import java.security.spec.X509EncodedKeySpec; import java.util.Arrays; -import java.util.List; import java.util.stream.Collectors; -import java.util.stream.IntStream; @Component public class KeystoreManager { diff --git a/juick-server/src/main/java/com/juick/server/SignatureManager.java b/juick-server/src/main/java/com/juick/server/SignatureManager.java index c610ea12..e9227b9d 100644 --- a/juick-server/src/main/java/com/juick/server/SignatureManager.java +++ b/juick-server/src/main/java/com/juick/server/SignatureManager.java @@ -2,7 +2,7 @@ package com.juick.server; import com.fasterxml.jackson.databind.ObjectMapper; import com.juick.server.api.activity.model.Context; -import com.juick.server.api.activity.model.Person; +import com.juick.server.api.activity.model.objects.Person; import com.juick.service.activities.DeleteUserEvent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/juick-server/src/main/java/com/juick/server/api/activity/Profile.java b/juick-server/src/main/java/com/juick/server/api/activity/Profile.java index 317c0e5b..ce09436d 100644 --- a/juick-server/src/main/java/com/juick/server/api/activity/Profile.java +++ b/juick-server/src/main/java/com/juick/server/api/activity/Profile.java @@ -10,17 +10,17 @@ import com.juick.server.KeystoreManager; import com.juick.server.SignatureManager; import com.juick.server.api.activity.model.Activity; import com.juick.server.api.activity.model.Context; -import com.juick.server.api.activity.model.Image; -import com.juick.server.api.activity.model.Key; -import com.juick.server.api.activity.model.Note; -import com.juick.server.api.activity.model.OrderedCollection; -import com.juick.server.api.activity.model.OrderedCollectionPage; -import com.juick.server.api.activity.model.Person; import com.juick.server.api.activity.model.activities.Announce; import com.juick.server.api.activity.model.activities.Create; import com.juick.server.api.activity.model.activities.Delete; import com.juick.server.api.activity.model.activities.Follow; import com.juick.server.api.activity.model.activities.Undo; +import com.juick.server.api.activity.model.objects.Image; +import com.juick.server.api.activity.model.objects.Key; +import com.juick.server.api.activity.model.objects.Note; +import com.juick.server.api.activity.model.objects.OrderedCollection; +import com.juick.server.api.activity.model.objects.OrderedCollectionPage; +import com.juick.server.api.activity.model.objects.Person; import com.juick.server.util.HttpBadRequestException; import com.juick.server.util.HttpNotFoundException; import com.juick.server.util.UserUtils; 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 0c47ef73..dd67fa64 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 @@ -5,9 +5,12 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.juick.server.api.activity.model.activities.*; +import com.juick.server.api.activity.model.objects.*; import java.time.Instant; +import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; @JsonIgnoreProperties(ignoreUnknown = true) @@ -36,12 +39,16 @@ public abstract class Context { private String id; + private String name; + private Instant published; private String url; private List to; + private List tags; + public String getId() { return id; } @@ -81,7 +88,8 @@ public abstract class Context { } public static Context build(Context response) { - response.context = Arrays.asList(ACTIVITY_STREAMS_URI, SECURITY_URI); + response.context = new ArrayList(Arrays.asList(ACTIVITY_STREAMS_URI, SECURITY_URI)); + response.context.add(Collections.singletonMap("Hashtag", "as:Hashtag")); return response; } @@ -92,4 +100,21 @@ public abstract class Context { public void setUrl(String url) { this.url = url; } + + @JsonProperty("tag") + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } } diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/Image.java b/juick-server/src/main/java/com/juick/server/api/activity/model/Image.java deleted file mode 100644 index 07d6ff99..00000000 --- a/juick-server/src/main/java/com/juick/server/api/activity/model/Image.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.juick.server.api.activity.model; - -public class Image extends Context { - private String mediaType; - - public String getMediaType() { - return mediaType; - } - - public void setMediaType(String mediaType) { - this.mediaType = mediaType; - } -} diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/Key.java b/juick-server/src/main/java/com/juick/server/api/activity/model/Key.java deleted file mode 100644 index bc41b460..00000000 --- a/juick-server/src/main/java/com/juick/server/api/activity/model/Key.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.juick.server.api.activity.model; - -public class Key extends Context { - private String owner; - private String publicKeyPem; - - public String getOwner() { - return owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getPublicKeyPem() { - return publicKeyPem; - } - - public void setPublicKeyPem(String publicKeyPem) { - this.publicKeyPem = publicKeyPem; - } -} diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/Link.java b/juick-server/src/main/java/com/juick/server/api/activity/model/Link.java deleted file mode 100644 index 543b5f0c..00000000 --- a/juick-server/src/main/java/com/juick/server/api/activity/model/Link.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.juick.server.api.activity.model; - -public class Link extends Context { - private String href; - - public String getHref() { - return href; - } - - public void setHref(String href) { - this.href = href; - } -} diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/Note.java b/juick-server/src/main/java/com/juick/server/api/activity/model/Note.java deleted file mode 100644 index 83ef36dd..00000000 --- a/juick-server/src/main/java/com/juick/server/api/activity/model/Note.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.juick.server.api.activity.model; - -import java.util.List; - -public class Note extends Context { - private String content; - private String attributedTo; - private String inReplyTo; - private Image attachment; - private List to; - private List cc; - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public String getAttributedTo() { - return attributedTo; - } - - public void setAttributedTo(String attributedTo) { - this.attributedTo = attributedTo; - } - - public Image getAttachment() { - return attachment; - } - - public void setAttachment(Image attachment) { - this.attachment = attachment; - } - - public List getTo() { - return to; - } - - public void setTo(List to) { - this.to = to; - } - - public List getCc() { - return cc; - } - - public void setCc(List cc) { - this.cc = cc; - } - - public String getInReplyTo() { - return inReplyTo; - } - - public void setInReplyTo(String inReplyTo) { - this.inReplyTo = inReplyTo; - } -} diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollection.java b/juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollection.java deleted file mode 100644 index d66c55be..00000000 --- a/juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollection.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.juick.server.api.activity.model; - -public class OrderedCollection extends Context { - - private int totalItems; - - public int getTotalItems() { - return totalItems; - } - - public void setTotalItems(int totalItems) { - this.totalItems = totalItems; - } - private String first; - - public String getFirst() { - return first; - } - - public void setFirst(String first) { - this.first = first; - } -} diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollectionPage.java b/juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollectionPage.java deleted file mode 100644 index bcae87d0..00000000 --- a/juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollectionPage.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.juick.server.api.activity.model; - -import java.util.List; - -public class OrderedCollectionPage extends Context { - - private String partOf; - - private String first; - - private String next; - - private String last; - - private List orderedItems; - - public String getNext() { - return next; - } - - public void setNext(String next) { - this.next = next; - } - - public List getOrderedItems() { - return orderedItems; - } - - public void setOrderedItems(List orderedItems) { - this.orderedItems = orderedItems; - } - - public String getPartOf() { - return partOf; - } - - public void setPartOf(String partOf) { - this.partOf = partOf; - } - - public String getFirst() { - return first; - } - - public void setFirst(String first) { - this.first = first; - } - - public String getLast() { - return last; - } - - public void setLast(String last) { - this.last = last; - } -} diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/Person.java b/juick-server/src/main/java/com/juick/server/api/activity/model/Person.java deleted file mode 100644 index 00006d4f..00000000 --- a/juick-server/src/main/java/com/juick/server/api/activity/model/Person.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.juick.server.api.activity.model; - -import com.fasterxml.jackson.annotation.JsonTypeInfo; - -public class Person extends Context { - - private String name; - private String preferredUsername; - private Image icon; - private String inbox; - private String outbox; - private String following; - private String followers; - private Key publicKey; - - @Override - public String getType() { - return "Person"; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) - public Image getIcon() { - return icon; - } - - public void setIcon(Image icon) { - this.icon = icon; - } - - public String getOutbox() { - return outbox; - } - - public void setOutbox(String outbox) { - this.outbox = outbox; - } - - public String getInbox() { - return inbox; - } - - public void setInbox(String inbox) { - this.inbox = inbox; - } - - public String getFollowing() { - return following; - } - - public void setFollowing(String following) { - this.following = following; - } - - public String getFollowers() { - return followers; - } - - public void setFollowers(String followers) { - this.followers = followers; - } - - @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) - public Key getPublicKey() { - return publicKey; - } - - public void setPublicKey(Key publicKey) { - this.publicKey = publicKey; - } - - public String getPreferredUsername() { - return preferredUsername; - } - - public void setPreferredUsername(String preferredUsername) { - this.preferredUsername = preferredUsername; - } -} diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Hashtag.java b/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Hashtag.java new file mode 100644 index 00000000..34e73be6 --- /dev/null +++ b/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Hashtag.java @@ -0,0 +1,6 @@ +package com.juick.server.api.activity.model.objects; + +import com.juick.server.api.activity.model.Context; + +public class Hashtag extends Context { +} diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Image.java b/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Image.java new file mode 100644 index 00000000..e067f729 --- /dev/null +++ b/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Image.java @@ -0,0 +1,15 @@ +package com.juick.server.api.activity.model.objects; + +import com.juick.server.api.activity.model.Context; + +public class Image extends Context { + private String mediaType; + + public String getMediaType() { + return mediaType; + } + + public void setMediaType(String mediaType) { + this.mediaType = mediaType; + } +} diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Key.java b/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Key.java new file mode 100644 index 00000000..075c51dd --- /dev/null +++ b/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Key.java @@ -0,0 +1,24 @@ +package com.juick.server.api.activity.model.objects; + +import com.juick.server.api.activity.model.Context; + +public class Key extends Context { + private String owner; + private String publicKeyPem; + + public String getOwner() { + return owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getPublicKeyPem() { + return publicKeyPem; + } + + public void setPublicKeyPem(String publicKeyPem) { + this.publicKeyPem = publicKeyPem; + } +} diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Link.java b/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Link.java new file mode 100644 index 00000000..0c4f26dc --- /dev/null +++ b/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Link.java @@ -0,0 +1,15 @@ +package com.juick.server.api.activity.model.objects; + +import com.juick.server.api.activity.model.Context; + +public class Link extends Context { + private String href; + + public String getHref() { + return href; + } + + public void setHref(String href) { + this.href = href; + } +} 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 new file mode 100644 index 00000000..dbf3bec9 --- /dev/null +++ b/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Mention.java @@ -0,0 +1,8 @@ +package com.juick.server.api.activity.model.objects; + +public class Mention extends Link { + public Mention(String href, 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 new file mode 100644 index 00000000..458b925c --- /dev/null +++ b/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Note.java @@ -0,0 +1,62 @@ +package com.juick.server.api.activity.model.objects; + +import com.juick.server.api.activity.model.Context; + +import java.util.List; + +public class Note extends Context { + private String content; + private String attributedTo; + private String inReplyTo; + private Image attachment; + private List to; + private List cc; + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getAttributedTo() { + return attributedTo; + } + + public void setAttributedTo(String attributedTo) { + this.attributedTo = attributedTo; + } + + public Image getAttachment() { + return attachment; + } + + public void setAttachment(Image attachment) { + this.attachment = attachment; + } + + public List getTo() { + return to; + } + + public void setTo(List to) { + this.to = to; + } + + public List getCc() { + return cc; + } + + public void setCc(List cc) { + this.cc = cc; + } + + public String getInReplyTo() { + return inReplyTo; + } + + public void setInReplyTo(String inReplyTo) { + this.inReplyTo = inReplyTo; + } +} diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/objects/OrderedCollection.java b/juick-server/src/main/java/com/juick/server/api/activity/model/objects/OrderedCollection.java new file mode 100644 index 00000000..426cf331 --- /dev/null +++ b/juick-server/src/main/java/com/juick/server/api/activity/model/objects/OrderedCollection.java @@ -0,0 +1,25 @@ +package com.juick.server.api.activity.model.objects; + +import com.juick.server.api.activity.model.Context; + +public class OrderedCollection extends Context { + + private int totalItems; + + public int getTotalItems() { + return totalItems; + } + + public void setTotalItems(int totalItems) { + this.totalItems = totalItems; + } + private String first; + + public String getFirst() { + return first; + } + + public void setFirst(String first) { + this.first = first; + } +} diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/objects/OrderedCollectionPage.java b/juick-server/src/main/java/com/juick/server/api/activity/model/objects/OrderedCollectionPage.java new file mode 100644 index 00000000..601919ba --- /dev/null +++ b/juick-server/src/main/java/com/juick/server/api/activity/model/objects/OrderedCollectionPage.java @@ -0,0 +1,58 @@ +package com.juick.server.api.activity.model.objects; + +import com.juick.server.api.activity.model.Context; + +import java.util.List; + +public class OrderedCollectionPage extends Context { + + private String partOf; + + private String first; + + private String next; + + private String last; + + private List orderedItems; + + public String getNext() { + return next; + } + + public void setNext(String next) { + this.next = next; + } + + public List getOrderedItems() { + return orderedItems; + } + + public void setOrderedItems(List orderedItems) { + this.orderedItems = orderedItems; + } + + public String getPartOf() { + return partOf; + } + + public void setPartOf(String partOf) { + this.partOf = partOf; + } + + public String getFirst() { + return first; + } + + public void setFirst(String first) { + this.first = first; + } + + public String getLast() { + return last; + } + + public void setLast(String last) { + this.last = last; + } +} diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Person.java b/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Person.java new file mode 100644 index 00000000..2d3a45d7 --- /dev/null +++ b/juick-server/src/main/java/com/juick/server/api/activity/model/objects/Person.java @@ -0,0 +1,87 @@ +package com.juick.server.api.activity.model.objects; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.juick.server.api.activity.model.Context; + +public class Person extends Context { + + private String name; + private String preferredUsername; + private Image icon; + private String inbox; + private String outbox; + private String following; + private String followers; + private Key publicKey; + + @Override + public String getType() { + return "Person"; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) + public Image getIcon() { + return icon; + } + + public void setIcon(Image icon) { + this.icon = icon; + } + + public String getOutbox() { + return outbox; + } + + public void setOutbox(String outbox) { + this.outbox = outbox; + } + + public String getInbox() { + return inbox; + } + + public void setInbox(String inbox) { + this.inbox = inbox; + } + + public String getFollowing() { + return following; + } + + public void setFollowing(String following) { + this.following = following; + } + + public String getFollowers() { + return followers; + } + + public void setFollowers(String followers) { + this.followers = followers; + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) + public Key getPublicKey() { + return publicKey; + } + + public void setPublicKey(Key publicKey) { + this.publicKey = publicKey; + } + + public String getPreferredUsername() { + return preferredUsername; + } + + public void setPreferredUsername(String preferredUsername) { + this.preferredUsername = preferredUsername; + } +} -- cgit v1.2.3