diff options
Diffstat (limited to 'src/main/java/com/juick/www/api/activity/model/activities')
-rw-r--r-- | src/main/java/com/juick/www/api/activity/model/activities/Flag.java | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/src/main/java/com/juick/www/api/activity/model/activities/Flag.java b/src/main/java/com/juick/www/api/activity/model/activities/Flag.java index 2c61d344..1c37dec0 100644 --- a/src/main/java/com/juick/www/api/activity/model/activities/Flag.java +++ b/src/main/java/com/juick/www/api/activity/model/activities/Flag.java @@ -17,8 +17,40 @@ package com.juick.www.api.activity.model.activities; -import com.juick.www.api.activity.model.Activity; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.juick.www.api.activity.helpers.ActivityIdDeserializer; +import com.juick.www.api.activity.helpers.ContextDeserializer; +import com.juick.www.api.activity.model.Context; +import org.apache.commons.lang3.StringUtils; -public class Flag extends Activity { - +import java.util.List; +import java.util.UUID; + +public class Flag extends Context { + + @JsonDeserialize(using = ActivityIdDeserializer.class) + private String actor; + + public String getActor() { + return actor; + } + + public void setActor(String actor) { + this.actor = actor; + if (StringUtils.isEmpty(getId())) { + setId(String.format("%s#%s", this.actor, UUID.randomUUID())); + } + } + + @JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY) + private List<String> object; + + public List<String> getObject() { + return object; + } + + public void setObject(List<String> object) { + this.object = object; + } } |