]> git.somenet.org - pub/jan/dst18.git/blob - ass3-event/src/main/java/dst/ass3/event/model/events/LifecycleEvent.java
Add template for assignment 3
[pub/jan/dst18.git] / ass3-event / src / main / java / dst / ass3 / event / model / events / LifecycleEvent.java
1 package dst.ass3.event.model.events;
2
3 import java.io.Serializable;
4
5 import dst.ass3.event.model.domain.IUploadEventInfo;
6 import dst.ass3.event.model.domain.RequestType;
7 import dst.ass3.event.model.domain.UploadState;
8
9 /**
10  * Indicates a change in the lifecycle state of an IUploadEventInfo.
11  */
12 public class LifecycleEvent implements Serializable {
13
14     private static final long serialVersionUID = 8665269919851487210L;
15
16     /**
17      * The id of the UploadRequest (the MOOC business concept), as returned by {@link IUploadEventInfo#getRequestId()}.
18      */
19     private long requestId;
20
21     private UploadState state;
22     private String server;
23     private RequestType requestType;
24
25     /**
26      * The instant the event was recorded (unix epoch in milliseconds)
27      */
28     private long timestamp;
29
30     public LifecycleEvent() {
31     }
32
33     public LifecycleEvent(IUploadEventInfo eventInfo) {
34         this(eventInfo.getRequestId(), eventInfo.getState(), eventInfo.getServer(), eventInfo.getRequestType(), eventInfo.getTimestamp());
35     }
36
37     public LifecycleEvent(long requestId, UploadState state, String server, RequestType requestType, long timestamp) {
38         this.requestId = requestId;
39         this.state = state;
40         this.server = server;
41         this.requestType = requestType;
42         this.timestamp = timestamp;
43     }
44
45     public long getRequestId() {
46         return requestId;
47     }
48
49     public void setRequestId(long requestId) {
50         this.requestId = requestId;
51     }
52
53     public UploadState getState() {
54         return state;
55     }
56
57     public void setState(UploadState state) {
58         this.state = state;
59     }
60
61     public String getServer() {
62         return server;
63     }
64
65     public void setServer(String server) {
66         this.server = server;
67     }
68
69     public RequestType getRequestType() {
70         return requestType;
71     }
72
73     public void setRequestType(RequestType requestType) {
74         this.requestType = requestType;
75     }
76
77     public long getTimestamp() {
78         return timestamp;
79     }
80
81     public void setTimestamp(long timestamp) {
82         this.timestamp = timestamp;
83     }
84
85     @Override
86     public String toString() {
87         return "LifecycleEvent{" +
88                 "requestId=" + requestId +
89                 ", state=" + state +
90                 ", server='" + server + '\'' +
91                 ", requestType=" + requestType +
92                 ", timestamp=" + timestamp +
93                 '}';
94     }
95 }