diff options
Diffstat (limited to 'src/main/java/com/juick/server/api/activity')
-rw-r--r-- | src/main/java/com/juick/server/api/activity/model/Activity.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/com/juick/server/api/activity/model/Activity.java b/src/main/java/com/juick/server/api/activity/model/Activity.java index d2ee712b..94e5c45e 100644 --- a/src/main/java/com/juick/server/api/activity/model/Activity.java +++ b/src/main/java/com/juick/server/api/activity/model/Activity.java @@ -2,6 +2,7 @@ package com.juick.server.api.activity.model; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.juick.server.api.activity.helpers.ActivityIdDeserializer; +import org.apache.commons.lang3.StringUtils; import java.util.UUID; @@ -11,16 +12,15 @@ public abstract class Activity extends Context { private String actor; private Object object; - public Activity() { - setId(UUID.randomUUID().toString()); - } - 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().toString())); + } } public Object getObject() { |