Package: EventStoreRecordImpl
EventStoreRecordImpl
name | instruction | branch | complexity | line | method | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
EventStoreRecordImpl() |
|
|
|
|
|
||||||||||||||||||||
EventStoreRecordImpl(EventStoreRecord) |
|
|
|
|
|
||||||||||||||||||||
EventStoreRecordImpl(KapuaId) |
|
|
|
|
|
||||||||||||||||||||
getContextId() |
|
|
|
|
|
||||||||||||||||||||
getEntityId() |
|
|
|
|
|
||||||||||||||||||||
getEntityType() |
|
|
|
|
|
||||||||||||||||||||
getInputs() |
|
|
|
|
|
||||||||||||||||||||
getNote() |
|
|
|
|
|
||||||||||||||||||||
getOperation() |
|
|
|
|
|
||||||||||||||||||||
getOutputs() |
|
|
|
|
|
||||||||||||||||||||
getScopeId() |
|
|
|
|
|
||||||||||||||||||||
getService() |
|
|
|
|
|
||||||||||||||||||||
getStatus() |
|
|
|
|
|
||||||||||||||||||||
getTimestamp() |
|
|
|
|
|
||||||||||||||||||||
getUserId() |
|
|
|
|
|
||||||||||||||||||||
setContextId(String) |
|
|
|
|
|
||||||||||||||||||||
setEntityId(KapuaId) |
|
|
|
|
|
||||||||||||||||||||
setEntityType(String) |
|
|
|
|
|
||||||||||||||||||||
setInputs(String) |
|
|
|
|
|
||||||||||||||||||||
setNote(String) |
|
|
|
|
|
||||||||||||||||||||
setOperation(String) |
|
|
|
|
|
||||||||||||||||||||
setOutputs(String) |
|
|
|
|
|
||||||||||||||||||||
setScopeId(KapuaId) |
|
|
|
|
|
||||||||||||||||||||
setService(String) |
|
|
|
|
|
||||||||||||||||||||
setStatus(ServiceEvent.EventStatus) |
|
|
|
|
|
||||||||||||||||||||
setTimestamp(Date) |
|
|
|
|
|
||||||||||||||||||||
setUserId(KapuaId) |
|
|
|
|
|
Coverage
1: /*******************************************************************************
2: * Copyright (c) 2017, 2022 Eurotech and/or its affiliates and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Eurotech - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.commons.service.event.store.internal;
14:
15: import org.eclipse.kapua.KapuaException;
16: import org.eclipse.kapua.commons.model.AbstractKapuaUpdatableEntity;
17: import org.eclipse.kapua.commons.model.id.KapuaEid;
18: import org.eclipse.kapua.commons.service.event.store.api.EventStoreRecord;
19: import org.eclipse.kapua.event.ServiceEvent.EventStatus;
20: import org.eclipse.kapua.model.id.KapuaId;
21:
22: import javax.persistence.AttributeOverride;
23: import javax.persistence.AttributeOverrides;
24: import javax.persistence.Basic;
25: import javax.persistence.Column;
26: import javax.persistence.Embedded;
27: import javax.persistence.Entity;
28: import javax.persistence.EnumType;
29: import javax.persistence.Enumerated;
30: import javax.persistence.Table;
31: import javax.persistence.Temporal;
32: import javax.persistence.TemporalType;
33: import java.util.Date;
34:
35: /**
36: * {@link EventStoreRecord} implementation
37: *
38: * @since 1.0.0
39: */
40: @Entity(name = "EventStoreRecord")
41: @Table(name = "sys_event_store")
42: public class EventStoreRecordImpl extends AbstractKapuaUpdatableEntity implements EventStoreRecord {
43:
44: private static final long serialVersionUID = -2416000835110726619L;
45:
46: @Basic
47: @Column(name = "context_id", nullable = false, updatable = false)
48: private String contextId;
49:
50: @Temporal(TemporalType.TIMESTAMP)
51: @Column(name = "event_on", nullable = false, updatable = false)
52: private Date timestamp;
53:
54: @Embedded
55: @AttributeOverrides({
56: @AttributeOverride(name = "eid", column = @Column(name = "user_id"))
57: })
58: private KapuaEid userId;
59:
60: @Basic
61: @Column(name = "service", nullable = false, updatable = false)
62: private String service;
63:
64: @Basic
65: @Column(name = "entity_type", nullable = false, updatable = false)
66: private String entityType;
67:
68: @Embedded
69: @AttributeOverrides({
70: @AttributeOverride(name = "eid", column = @Column(name = "entity_id"))
71: })
72: private KapuaEid entityId;
73:
74: @Basic
75: @Column(name = "operation", nullable = false, updatable = false)
76: private String operation;
77:
78: @Basic
79: @Column(name = "inputs", nullable = false, updatable = false)
80: private String inputs;
81:
82: @Basic
83: @Column(name = "outputs", nullable = true, updatable = true)
84: private String outputs;
85:
86: @Enumerated(EnumType.STRING)
87: @Column(name = "status", nullable = true, updatable = true)
88: private EventStatus status;
89:
90: @Basic
91: @Column(name = "note", nullable = true, updatable = true)
92: private String note;
93:
94: public EventStoreRecordImpl() {
95: status = EventStatus.TRIGGERED;
96: }
97:
98: /**
99: * Constructor.
100: *
101: * @param scopeId
102: * @since 1.0.0
103: */
104: public EventStoreRecordImpl(KapuaId scopeId) {
105: super(scopeId);
106: }
107:
108: /**
109: * Clone constructor
110: *
111: * @throws KapuaException
112: * @since 1.1.0
113: */
114: public EventStoreRecordImpl(EventStoreRecord eventStoreRecord) throws KapuaException {
115: super(eventStoreRecord);
116:
117: setContextId(eventStoreRecord.getContextId());
118: setTimestamp(eventStoreRecord.getTimestamp());
119: setUserId(eventStoreRecord.getUserId());
120: setService(eventStoreRecord.getService());
121: setEntityType(eventStoreRecord.getEntityType());
122: setEntityId(eventStoreRecord.getEntityId());
123: setOperation(eventStoreRecord.getOperation());
124: setInputs(eventStoreRecord.getInputs());
125: setOutputs(eventStoreRecord.getOutputs());
126: setStatus(eventStoreRecord.getStatus());
127: setNote(eventStoreRecord.getNote());
128: }
129:
130: @Override
131: public String getContextId() {
132: return contextId;
133: }
134:
135: @Override
136: public void setContextId(String contextId) {
137: this.contextId = contextId;
138: }
139:
140: @Override
141: public Date getTimestamp() {
142: return timestamp;
143: }
144:
145: @Override
146: public void setTimestamp(Date timestamp) {
147: this.timestamp = timestamp;
148: }
149:
150: @Override
151: public KapuaId getUserId() {
152: return userId;
153: }
154:
155: @Override
156: public void setUserId(KapuaId userId) {
157: this.userId = KapuaEid.parseKapuaId(userId);
158: }
159:
160: @Override
161: public String getService() {
162: return service;
163: }
164:
165: @Override
166: public void setService(String service) {
167: this.service = service;
168: }
169:
170: @Override
171: public String getEntityType() {
172: return entityType;
173: }
174:
175: @Override
176: public void setEntityType(String entityType) {
177: this.entityType = entityType;
178: }
179:
180: @Override
181: public KapuaId getScopeId() {
182: return scopeId;
183: }
184:
185: @Override
186: public void setScopeId(KapuaId scopeId) {
187: this.scopeId = KapuaEid.parseKapuaId(scopeId);
188: }
189:
190: @Override
191: public KapuaId getEntityId() {
192: return entityId;
193: }
194:
195: @Override
196: public void setEntityId(KapuaId entityId) {
197: this.entityId = KapuaEid.parseKapuaId(entityId);
198: }
199:
200: @Override
201: public String getOperation() {
202: return operation;
203: }
204:
205: @Override
206: public void setOperation(String operation) {
207: this.operation = operation;
208: }
209:
210: @Override
211: public String getInputs() {
212: return inputs;
213: }
214:
215: @Override
216: public void setInputs(String inputs) {
217: this.inputs = inputs;
218: }
219:
220: @Override
221: public String getOutputs() {
222: return outputs;
223: }
224:
225: @Override
226: public void setOutputs(String outputs) {
227: this.outputs = outputs;
228: }
229:
230: @Override
231: public EventStatus getStatus() {
232: return status;
233: }
234:
235: @Override
236: public void setStatus(EventStatus status) {
237: this.status = status;
238: }
239:
240: @Override
241: public String getNote() {
242: return note;
243: }
244:
245: @Override
246: public void setNote(String note) {
247: this.note = note;
248: }
249: }