From a63800dd6c5f8551b7126be6d3557e90888f0703 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 4 Sep 2018 13:52:10 +0300 Subject: outbox as OrderedCollection --- .../server/api/activity/model/ActivityObject.java | 14 ++++++++++-- .../juick/server/api/activity/model/Article.java | 22 ++++++++++++++++++ .../juick/server/api/activity/model/Create.java | 23 +++++++++++++++++++ .../com/juick/server/api/activity/model/Link.java | 13 +++++++++++ .../api/activity/model/OrderedCollection.java | 23 +++++++++++++++++++ .../api/activity/model/OrderedCollectionPage.java | 26 ++++++++++++++++++++++ .../juick/server/api/activity/model/Person.java | 10 --------- 7 files changed, 119 insertions(+), 12 deletions(-) create mode 100644 juick-server/src/main/java/com/juick/server/api/activity/model/Article.java create mode 100644 juick-server/src/main/java/com/juick/server/api/activity/model/Create.java create mode 100644 juick-server/src/main/java/com/juick/server/api/activity/model/Link.java create mode 100644 juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollection.java create mode 100644 juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollectionPage.java (limited to 'juick-server/src/main/java/com/juick/server/api/activity/model') diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/ActivityObject.java b/juick-server/src/main/java/com/juick/server/api/activity/model/ActivityObject.java index bc682d2b..dcc94bf7 100644 --- a/juick-server/src/main/java/com/juick/server/api/activity/model/ActivityObject.java +++ b/juick-server/src/main/java/com/juick/server/api/activity/model/ActivityObject.java @@ -4,9 +4,19 @@ import com.fasterxml.jackson.annotation.JsonProperty; public abstract class ActivityObject { - public abstract String getId(); + private String id; - public abstract String getType(); + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getType() { + return getClass().getName(); + } @JsonProperty("@context") public String getContext() { diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/Article.java b/juick-server/src/main/java/com/juick/server/api/activity/model/Article.java new file mode 100644 index 00000000..e117475d --- /dev/null +++ b/juick-server/src/main/java/com/juick/server/api/activity/model/Article.java @@ -0,0 +1,22 @@ +package com.juick.server.api.activity.model; + +public class Article extends ActivityObject { + private String content; + private String attributedTo; + + 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; + } +} diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/Create.java b/juick-server/src/main/java/com/juick/server/api/activity/model/Create.java new file mode 100644 index 00000000..7b4e7b16 --- /dev/null +++ b/juick-server/src/main/java/com/juick/server/api/activity/model/Create.java @@ -0,0 +1,23 @@ +package com.juick.server.api.activity.model; + +public class Create extends ActivityObject { + + private Person actor; + private Article object; + + public Person getActor() { + return actor; + } + + public void setActor(Person actor) { + this.actor = actor; + } + + public Article getObject() { + return object; + } + + public void setObject(Article object) { + this.object = object; + } +} 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 new file mode 100644 index 00000000..b57dabbe --- /dev/null +++ b/juick-server/src/main/java/com/juick/server/api/activity/model/Link.java @@ -0,0 +1,13 @@ +package com.juick.server.api.activity.model; + +public class Link extends ActivityObject { + 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/OrderedCollection.java b/juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollection.java new file mode 100644 index 00000000..84654b19 --- /dev/null +++ b/juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollection.java @@ -0,0 +1,23 @@ +package com.juick.server.api.activity.model; + +public class OrderedCollection extends ActivityObject { + + private int totalItems; + + public int getTotalItems() { + return totalItems; + } + + public void setTotalItems(int totalItems) { + this.totalItems = totalItems; + } + private OrderedCollectionPage first; + + public OrderedCollectionPage getFirst() { + return first; + } + + public void setFirst(OrderedCollectionPage 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 new file mode 100644 index 00000000..9e03cb79 --- /dev/null +++ b/juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollectionPage.java @@ -0,0 +1,26 @@ +package com.juick.server.api.activity.model; + +import java.util.List; + +public class OrderedCollectionPage extends ActivityObject { + + private Link next; + + private List orderedItems; + + public Link getNext() { + return next; + } + + public void setNext(Link next) { + this.next = next; + } + + public List getOrderedItems() { + return orderedItems; + } + + public void setOrderedItems(List orderedItems) { + this.orderedItems = orderedItems; + } +} 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 index 031cd73b..7ec94c28 100644 --- 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 @@ -2,16 +2,10 @@ package com.juick.server.api.activity.model; public class Person extends ActivityObject { - private String id; private String name; private String icon; private String outbox; - @Override - public String getId() { - return id; - } - @Override public String getType() { return "Person"; @@ -40,8 +34,4 @@ public class Person extends ActivityObject { public void setOutbox(String outbox) { this.outbox = outbox; } - - public void setId(String id) { - this.id = id; - } } -- cgit v1.2.3