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 com.google.common.base.Objects;
\r
24 import org.apache.hadoop.io.Writable;
\r
25 import org.apache.hadoop.io.WritableUtils;
\r
27 import java.io.DataInput;
\r
28 import java.io.DataOutput;
\r
29 import java.io.IOException;
\r
30 import java.io.Serializable;
\r
33 * TCA Alerts Abatement Entity is used to persist information to determine if abatement event need to sent to downstream
\r
36 * @author Rajiv Singla . Creation Date: 9/11/2017.
\r
38 public class TCAAlertsAbatementEntity implements Writable, Serializable {
\r
40 private static final long serialVersionUID = 1L;
\r
42 private long creationTS;
\r
43 private String requestId;
\r
44 // Kept as string to avoid null checks
\r
45 private String abatementSentTS;
\r
48 * No Arg constructor required for Jackson Json Serialization / Deserialization
\r
50 public TCAAlertsAbatementEntity() {
\r
51 // required no arg constructor
\r
55 * Creates TCA Alerts Abatement Entity to persist information to determine if abatement alerts need to be posted
\r
57 * @param creationTS record creation time
\r
58 * @param requestId request ID of generated alert
\r
59 * @param abatementSentTS time when abatement was sent out for that alert if any
\r
61 public TCAAlertsAbatementEntity(long creationTS, String requestId, String abatementSentTS) {
\r
62 this.creationTS = creationTS;
\r
63 this.requestId = requestId;
\r
64 this.abatementSentTS = abatementSentTS;
\r
68 * Timestamp when record was created
\r
70 * @return timestamp when record was created
\r
72 public long getCreationTS() {
\r
77 * Set value for timestamp when record was created
\r
79 * @param creationTS new value for timestamp when record was created
\r
81 public void setCreationTS(long creationTS) {
\r
82 this.creationTS = creationTS;
\r
86 * Request Id of ONSET alert which was sent
\r
88 * @return request Id of ONSET alert which was sent
\r
90 public String getRequestId() {
\r
95 * Set Request Id of ONSET alert
\r
97 * @param requestId set new value for ONSET alert request id
\r
99 public void setRequestId(String requestId) {
\r
100 this.requestId = requestId;
\r
105 * Get abatement Sent Timestamp
\r
107 * @return get abatement alert sent timestamp
\r
109 public String getAbatementSentTS() {
\r
110 return abatementSentTS;
\r
114 * Set timestamp when abatement alert is sent
\r
116 * @param abatementSentTS sent new value for timestamp when abatement alert is sent
\r
118 public void setAbatementSentTS(String abatementSentTS) {
\r
119 this.abatementSentTS = abatementSentTS;
\r
123 * Write entity to Table
\r
125 * @param dataOutput data output
\r
126 * @throws IOException io exception
\r
129 public void write(DataOutput dataOutput) throws IOException {
\r
130 WritableUtils.writeVLong(dataOutput, creationTS);
\r
131 WritableUtils.writeString(dataOutput, requestId);
\r
132 WritableUtils.writeString(dataOutput, abatementSentTS);
\r
136 * Read entity from table
\r
138 * @param dataInput data input
\r
139 * @throws IOException io exception
\r
142 public void readFields(DataInput dataInput) throws IOException {
\r
143 creationTS = WritableUtils.readVLong(dataInput);
\r
144 requestId = WritableUtils.readString(dataInput);
\r
145 abatementSentTS = WritableUtils.readString(dataInput);
\r
150 public String toString() {
\r
151 return Objects.toStringHelper(this)
\r
152 .add("creationTS", creationTS)
\r
153 .add("requestId", requestId)
\r
154 .add("abatementSentTS", abatementSentTS)
\r