2 * ===============================LICENSE_START======================================
\r
4 * ================================================================================
\r
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============================LICENSE_END===========================================
\r
21 package org.openecomp.dcae.apod.analytics.cdap.common.persistance.tca;
\r
23 import org.apache.hadoop.io.Writable;
\r
24 import org.apache.hadoop.io.WritableUtils;
\r
25 import org.openecomp.dcae.apod.analytics.model.domain.policy.tca.Direction;
\r
26 import org.openecomp.dcae.apod.analytics.model.domain.policy.tca.TCAPolicy;
\r
27 import org.openecomp.dcae.apod.analytics.tca.processor.TCACEFJsonProcessor;
\r
28 import org.openecomp.dcae.apod.analytics.tca.processor.TCACEFPolicyDomainFilter;
\r
29 import org.openecomp.dcae.apod.analytics.tca.processor.TCACEFPolicyEventNameFilter;
\r
30 import org.openecomp.dcae.apod.analytics.tca.processor.TCACEFPolicyThresholdsProcessor;
\r
32 import java.io.DataInput;
\r
33 import java.io.DataOutput;
\r
34 import java.io.IOException;
\r
35 import java.io.Serializable;
\r
38 * TCA Message Status is an Entity which is used to persist TCA VES Message status information in Message Status Table
\r
40 * @author Rajiv Singla . Creation Date: 11/16/2016.
\r
42 public class TCAMessageStatusEntity implements Writable, Serializable {
\r
44 private static final long serialVersionUID = 1L;
\r
46 private long creationTS;
\r
47 private int instanceId;
\r
48 private String messageType;
\r
49 private String vesMessage;
\r
50 private String domain;
\r
51 private String eventName;
\r
52 private String thresholdPath;
\r
53 private String thresholdSeverity;
\r
54 private String thresholdDirection;
\r
55 private Long thresholdValue;
\r
56 private String jsonProcessorStatus;
\r
57 private String jsonProcessorMessage;
\r
58 private String domainFilterStatus;
\r
59 private String domainFilterMessage;
\r
60 private String eventNameFilterStatus;
\r
61 private String eventNameFilterMessage;
\r
62 private String thresholdCalculatorStatus;
\r
63 private String thresholdCalculatorMessage;
\r
64 private String alertMessage;
\r
67 * No Arg constructor required for Jackson Json Serialization / Deserialization
\r
69 public TCAMessageStatusEntity() {
\r
70 // no argument constructor required for json serialization / deserialization
\r
74 * Create new Instance of {@link TCAMessageStatusEntity}
\r
76 * @param creationTS creation Timestamp
\r
77 * @param instanceId CDAP flowlet instance ID
\r
78 * @param messageType {@link TCACalculatorMessageType}
\r
79 * @param vesMessage incoming VES message from collector
\r
80 * @param domain VES message domain if present
\r
81 * @param eventName VES message functional role if present
\r
83 public TCAMessageStatusEntity(final long creationTS, final int instanceId, final String messageType,
\r
84 final String vesMessage, final String domain, final String eventName) {
\r
85 this(creationTS, instanceId, messageType, vesMessage, domain, eventName, null, null, null, null,
\r
86 null, null, null, null, null, null, null, null, null);
\r
91 * Create new Instance of {@link TCAMessageStatusEntity}
\r
93 * @param creationTS creation Timestamp
\r
94 * @param instanceId CDAP flowlet instance ID
\r
95 * @param messageType {@link TCACalculatorMessageType}
\r
96 * @param vesMessage incoming VES message from collector
\r
97 * @param domain VES message domain if present
\r
98 * @param eventName VES message event name if present
\r
99 * @param thresholdPath Violated threshold path
\r
100 * @param thresholdSeverity Violated threshold Severity if any
\r
101 * @param thresholdDirection Violated threshold Direction if any
\r
102 * @param thresholdValue Violated threshold value if any
\r
103 * @param jsonProcessorStatus {@link TCACEFJsonProcessor} status
\r
104 * @param jsonProcessorMessage {@link TCACEFJsonProcessor} message
\r
105 * @param domainFilterStatus {@link TCACEFPolicyDomainFilter} status
\r
106 * @param domainFilterMessage {@link TCACEFPolicyDomainFilter} message
\r
107 * @param eventNameFilterStatus {@link TCACEFPolicyEventNameFilter} status
\r
108 * @param eventNameFilterMessage {@link TCACEFPolicyEventNameFilter} message
\r
109 * @param thresholdCalculatorStatus {@link TCACEFPolicyThresholdsProcessor} status
\r
110 * @param thresholdCalculatorMessage {@link TCACEFPolicyThresholdsProcessor} message
\r
111 * @param alertMessage alert message that will be sent out in case of threshold violation
\r
113 public TCAMessageStatusEntity(long creationTS, int instanceId, String messageType, String vesMessage,
\r
114 String domain, String eventName,
\r
115 String thresholdPath, String thresholdSeverity, String thresholdDirection,
\r
116 Long thresholdValue,
\r
117 String jsonProcessorStatus, String jsonProcessorMessage,
\r
118 String domainFilterStatus, String domainFilterMessage,
\r
119 String eventNameFilterStatus, String eventNameFilterMessage,
\r
120 String thresholdCalculatorStatus, String thresholdCalculatorMessage,
\r
121 String alertMessage) {
\r
122 this.creationTS = creationTS;
\r
123 this.instanceId = instanceId;
\r
124 this.messageType = messageType;
\r
125 this.vesMessage = vesMessage;
\r
126 this.domain = domain;
\r
127 this.eventName = eventName;
\r
128 this.thresholdPath = thresholdPath;
\r
129 this.thresholdSeverity = thresholdSeverity;
\r
130 this.thresholdDirection = thresholdDirection;
\r
131 this.thresholdValue = thresholdValue;
\r
132 this.jsonProcessorStatus = jsonProcessorStatus;
\r
133 this.jsonProcessorMessage = jsonProcessorMessage;
\r
134 this.domainFilterStatus = domainFilterStatus;
\r
135 this.domainFilterMessage = domainFilterMessage;
\r
136 this.eventNameFilterStatus = eventNameFilterStatus;
\r
137 this.eventNameFilterMessage = eventNameFilterMessage;
\r
138 this.thresholdCalculatorStatus = thresholdCalculatorStatus;
\r
139 this.thresholdCalculatorMessage = thresholdCalculatorMessage;
\r
140 this.alertMessage = alertMessage;
\r
144 * Provides Creation Timestamp
\r
146 * @return creation timestamp long value
\r
148 public long getCreationTS() {
\r
153 * Sets Creations Timestamp
\r
155 * @param creationTS creation timestamp long value
\r
157 public void setCreationTS(long creationTS) {
\r
158 this.creationTS = creationTS;
\r
163 * Provides CDAP Flowlet instance ID
\r
165 * @return cdap flowlet instance ID
\r
167 public int getInstanceId() {
\r
172 * Sets CDAP Flowlet instance ID
\r
174 * @param instanceId flowlet instance ID
\r
176 public void setInstanceId(int instanceId) {
\r
177 this.instanceId = instanceId;
\r
181 * Provides Message Calculator Type {@link TCACalculatorMessageType}
\r
183 * @return calculator message type
\r
185 public String getMessageType() {
\r
186 return messageType;
\r
190 * Sets Calculator message Type {@link TCACalculatorMessageType}
\r
192 * @param messageType calculator message type
\r
194 public void setMessageType(String messageType) {
\r
195 this.messageType = messageType;
\r
199 * Provides incoming VES Message
\r
201 * @return ves message
\r
203 public String getVesMessage() {
\r
208 * Set new value for VES message
\r
210 * @param vesMessage ves message
\r
212 public void setVesMessage(String vesMessage) {
\r
213 this.vesMessage = vesMessage;
\r
217 * Provides VES message Domain
\r
219 * @return ves message domain
\r
221 public String getDomain() {
\r
226 * Sets VES Message Domain
\r
228 * @param domain ves message domain
\r
230 public void setDomain(String domain) {
\r
231 this.domain = domain;
\r
235 * Provides VES Message Event Name
\r
237 * @return ves message Event Name
\r
239 public String getEventName() {
\r
244 * Sets VES Message Functional Role
\r
246 * @param eventName ves message Functional Role
\r
248 public void setEventName(String eventName) {
\r
249 this.eventName = eventName;
\r
253 * Violated Threshold Path as extracted from {@link TCAPolicy}
\r
255 * @return violated threshold path
\r
257 public String getThresholdPath() {
\r
258 return thresholdPath;
\r
262 * Sets value for Violated Threshold Path
\r
264 * @param thresholdPath violated threshold path
\r
266 public void setThresholdPath(String thresholdPath) {
\r
267 this.thresholdPath = thresholdPath;
\r
271 * Violated threshold Event Severity
\r
273 * @return event severity
\r
275 public String getThresholdSeverity() {
\r
276 return thresholdSeverity;
\r
280 * Violated Threshold Severity
\r
282 * @param thresholdSeverity violated threshold severity
\r
284 public void setThresholdSeverity(String thresholdSeverity) {
\r
285 this.thresholdSeverity = thresholdSeverity;
\r
289 * Violated Threshold {@link Direction}
\r
291 * @return violated threshold Direction
\r
293 public String getThresholdDirection() {
\r
294 return thresholdDirection;
\r
298 * Sets Violated Threshold Direction
\r
300 * @param thresholdDirection violated threshold direction
\r
302 public void setThresholdDirection(String thresholdDirection) {
\r
303 this.thresholdDirection = thresholdDirection;
\r
307 * Provides Violated Threshold Value
\r
309 * @return violated Threshold value
\r
311 public Long getThresholdValue() {
\r
312 return thresholdValue;
\r
316 * Sets Violated Threshold Value
\r
318 * @param thresholdValue violated threshold value
\r
320 public void setThresholdValue(Long thresholdValue) {
\r
321 this.thresholdValue = thresholdValue;
\r
325 * Provides {@link TCACEFJsonProcessor} status
\r
327 * @return json processor status
\r
329 public String getJsonProcessorStatus() {
\r
330 return jsonProcessorStatus;
\r
334 * Sets Json Processor status
\r
336 * @param jsonProcessorStatus json processor status
\r
338 public void setJsonProcessorStatus(String jsonProcessorStatus) {
\r
339 this.jsonProcessorStatus = jsonProcessorStatus;
\r
343 * Provides {@link TCACEFJsonProcessor} message
\r
345 * @return json processor message
\r
347 public String getJsonProcessorMessage() {
\r
348 return jsonProcessorMessage;
\r
352 * Sets Json Processor Message
\r
354 * @param jsonProcessorMessage json processor message
\r
356 public void setJsonProcessorMessage(String jsonProcessorMessage) {
\r
357 this.jsonProcessorMessage = jsonProcessorMessage;
\r
361 * Provides {@link TCACEFPolicyDomainFilter} status
\r
363 * @return domain filter status
\r
365 public String getDomainFilterStatus() {
\r
366 return domainFilterStatus;
\r
370 * Sets Domain Filter status
\r
372 * @param domainFilterStatus domain filter status
\r
374 public void setDomainFilterStatus(String domainFilterStatus) {
\r
375 this.domainFilterStatus = domainFilterStatus;
\r
379 * Provides {@link TCACEFPolicyDomainFilter} message
\r
381 * @return domain filter message
\r
383 public String getDomainFilterMessage() {
\r
384 return domainFilterMessage;
\r
388 * Sets Domain filter message
\r
390 * @param domainFilterMessage domain filter message
\r
392 public void setDomainFilterMessage(String domainFilterMessage) {
\r
393 this.domainFilterMessage = domainFilterMessage;
\r
396 public String getEventNameFilterStatus() {
\r
397 return eventNameFilterStatus;
\r
401 * Provides {@link TCACEFPolicyEventNameFilter} status
\r
403 * @param eventNameFilterStatus functional Role filter status
\r
405 public void setEventNameFilterStatus(String eventNameFilterStatus) {
\r
406 this.eventNameFilterStatus = eventNameFilterStatus;
\r
410 * Provides {@link TCACEFPolicyEventNameFilter} message
\r
412 * @return functional role filter message
\r
414 public String getEventNameFilterMessage() {
\r
415 return eventNameFilterMessage;
\r
419 * Sets Functional Role filter message
\r
421 * @param eventNameFilterMessage functional role filter message
\r
423 public void setEventNameFilterMessage(String eventNameFilterMessage) {
\r
424 this.eventNameFilterMessage = eventNameFilterMessage;
\r
428 * Provides {@link TCACEFPolicyThresholdsProcessor} status
\r
430 * @return threshold processor status
\r
432 public String getThresholdCalculatorStatus() {
\r
433 return thresholdCalculatorStatus;
\r
437 * Sets threshold calculator status
\r
439 * @param thresholdCalculatorStatus threshold calculator status
\r
441 public void setThresholdCalculatorStatus(String thresholdCalculatorStatus) {
\r
442 this.thresholdCalculatorStatus = thresholdCalculatorStatus;
\r
446 * Provides {@link TCACEFPolicyThresholdsProcessor} message
\r
448 * @return threshold processor message
\r
450 public String getThresholdCalculatorMessage() {
\r
451 return thresholdCalculatorMessage;
\r
455 * Sets Threshold Calculator Processor Message
\r
457 * @param thresholdCalculatorMessage threshold calculator message
\r
459 public void setThresholdCalculatorMessage(String thresholdCalculatorMessage) {
\r
460 this.thresholdCalculatorMessage = thresholdCalculatorMessage;
\r
464 * Provides generated alert message
\r
466 * @return generated alert message
\r
468 public String getAlertMessage() {
\r
469 return alertMessage;
\r
473 * Sets alert message
\r
475 * @param alertMessage alert message
\r
477 public void setAlertMessage(String alertMessage) {
\r
478 this.alertMessage = alertMessage;
\r
482 * Write entity to Table
\r
484 * @param dataOutput data output
\r
486 * @throws IOException io exception
\r
489 public void write(DataOutput dataOutput) throws IOException {
\r
490 WritableUtils.writeVLong(dataOutput, creationTS);
\r
491 WritableUtils.writeVInt(dataOutput, instanceId);
\r
492 WritableUtils.writeString(dataOutput, messageType);
\r
493 WritableUtils.writeString(dataOutput, vesMessage);
\r
495 WritableUtils.writeString(dataOutput, domain);
\r
496 WritableUtils.writeString(dataOutput, eventName);
\r
498 WritableUtils.writeString(dataOutput, thresholdPath);
\r
499 WritableUtils.writeString(dataOutput, thresholdSeverity);
\r
500 WritableUtils.writeString(dataOutput, thresholdDirection);
\r
501 WritableUtils.writeVLong(dataOutput, thresholdValue);
\r
503 WritableUtils.writeString(dataOutput, jsonProcessorStatus);
\r
504 WritableUtils.writeString(dataOutput, jsonProcessorMessage);
\r
505 WritableUtils.writeString(dataOutput, domainFilterStatus);
\r
506 WritableUtils.writeString(dataOutput, domainFilterMessage);
\r
507 WritableUtils.writeString(dataOutput, eventNameFilterStatus);
\r
508 WritableUtils.writeString(dataOutput, eventNameFilterMessage);
\r
509 WritableUtils.writeString(dataOutput, thresholdCalculatorStatus);
\r
510 WritableUtils.writeString(dataOutput, thresholdCalculatorMessage);
\r
512 WritableUtils.writeString(dataOutput, alertMessage);
\r
517 * Read entity from table
\r
519 * @param dataInput data input
\r
520 * @throws IOException io exception
\r
523 public void readFields(DataInput dataInput) throws IOException {
\r
524 creationTS = WritableUtils.readVLong(dataInput);
\r
525 instanceId = WritableUtils.readVInt(dataInput);
\r
526 messageType = WritableUtils.readString(dataInput);
\r
527 vesMessage = WritableUtils.readString(dataInput);
\r
529 domain = WritableUtils.readString(dataInput);
\r
530 eventName = WritableUtils.readString(dataInput);
\r
532 thresholdPath = WritableUtils.readString(dataInput);
\r
533 thresholdSeverity = WritableUtils.readString(dataInput);
\r
534 thresholdDirection = WritableUtils.readString(dataInput);
\r
535 thresholdValue = WritableUtils.readVLong(dataInput);
\r
537 jsonProcessorStatus = WritableUtils.readString(dataInput);
\r
538 jsonProcessorMessage = WritableUtils.readString(dataInput);
\r
539 domainFilterStatus = WritableUtils.readString(dataInput);
\r
540 domainFilterMessage = WritableUtils.readString(dataInput);
\r
541 eventNameFilterStatus = WritableUtils.readString(dataInput);
\r
542 eventNameFilterMessage = WritableUtils.readString(dataInput);
\r
543 thresholdCalculatorStatus = WritableUtils.readString(dataInput);
\r
544 thresholdCalculatorMessage = WritableUtils.readString(dataInput);
\r
546 alertMessage = WritableUtils.readString(dataInput);
\r