1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.logging.log4j.catalog.api;
18
19 import java.io.Serializable;
20 import java.util.List;
21 import java.util.Set;
22
23 import com.fasterxml.jackson.annotation.JsonFilter;
24
25 import static org.apache.logging.log4j.catalog.api.constant.Constants.DEFAULT_CATALOG;
26
27
28
29
30 @JsonFilter("catalogEvent")
31 public class Event implements Serializable {
32
33 private static final long serialVersionUID = 1512172827909901054L;
34 private Long id;
35 private String name;
36 private String displayName;
37 private String description;
38 private Set<String> aliases;
39 private String catalogId;
40 private List<EventAttribute> attributes;
41
42
43
44
45 public Event() {
46 catalogId = DEFAULT_CATALOG;
47 }
48
49
50
51
52
53 public Long getId() {
54 return id;
55 }
56
57
58
59
60
61 public void setId(Long id) {
62 this.id = id;
63 }
64
65
66
67
68
69 public String getName() {
70 return name;
71 }
72
73
74
75
76
77
78 public Event setName(String name) {
79 this.name = name;
80 return this;
81 }
82
83
84
85
86
87 public String getDisplayName() {
88 return displayName;
89 }
90
91
92
93
94
95
96 public Event setDisplayName(String name) {
97 this.displayName = name;
98 return this;
99 }
100
101
102
103
104
105 public String getDescription() {
106 return description;
107 }
108
109
110
111
112
113
114 public Event setDescription(String description) {
115 this.description = description;
116 return this;
117 }
118
119
120
121
122
123 public String getCatalogId() {
124 return catalogId;
125 }
126
127
128
129
130
131 public Event setCatalogId(String catalogId) {
132 if (catalogId != null) {
133 this.catalogId = catalogId;
134 }
135 return this;
136 }
137
138
139
140
141
142 public Set<String> getAliases() {
143 return aliases;
144 }
145
146
147
148
149
150
151 public Event setAliases(Set<String> aliases) {
152 this.aliases = aliases;
153 return this;
154 }
155
156
157
158
159
160 public List<EventAttribute> getAttributes() {
161 return attributes;
162 }
163
164
165
166
167
168
169 public Event setAttributes(List<EventAttribute> attributes) {
170 this.attributes = attributes;
171 return this;
172 }
173
174 public String toString() {
175 StringBuilder sb = new StringBuilder();
176 sb.append("{\"name\" : \"").append(name).append("\", \"displayName\" : \"").append(displayName).append("\"");
177 sb.append(", \"description\" : \"").append(description).append("\", \"attributes\" : [");
178 boolean first = true;
179 for (EventAttribute attribute : attributes) {
180 if (!first) {
181 sb.append(", ");
182 } else {
183 first = false;
184 }
185 sb.append("{\"name\" : \"").append(attribute.getName()).append("\", \"required\" : ").append(attribute.isRequired()).append("}");
186 }
187 sb.append("]}");
188 return sb.toString();
189 }
190 }