aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/server/api/activity/model/Activity.java
blob: 94e5c45ede85632375d8a706165262c379bebadd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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;

public abstract class Activity extends Context {

    @JsonDeserialize(using = ActivityIdDeserializer.class)
    private String actor;
    private Object object;

    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() {
        return object;
    }

    public void setObject(Object object) {
        this.object = object;
    }
}