4 /*******************************************************************************
5 * ============LICENSE_START=======================================================
7 * ================================================================================
8 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
9 * ================================================================================
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
22 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
24 *******************************************************************************/
25 package org.onap.dmaap.dmf.mr.beans;
27 import org.onap.dmaap.dmf.mr.constants.CambriaConstants;
28 import org.onap.dmaap.dmf.mr.utils.Utils;
30 import java.util.Date;
33 * @author muzainulhaque.qazi
37 public class LogDetails {
39 private String publisherId;
40 private String topicId;
41 private String subscriberGroupId;
42 private String subscriberId;
43 private String publisherIp;
44 private String messageBatchId;
45 private String messageSequence;
46 private String messageTimestamp;
47 private String consumeTimestamp;
48 private String transactionIdTs;
49 private String serverIp;
51 private long messageLengthInBytes;
52 private long totalMessageCount;
54 private boolean transactionEnabled;
56 * This is for transaction enabled logging details
63 public String getTransactionId() {
64 StringBuilder transactionId = new StringBuilder();
65 transactionId.append(transactionIdTs);
66 transactionId.append(CambriaConstants.TRANSACTION_ID_SEPARATOR);
67 transactionId.append(publisherIp);
68 transactionId.append(CambriaConstants.TRANSACTION_ID_SEPARATOR);
69 transactionId.append(messageBatchId);
70 transactionId.append(CambriaConstants.TRANSACTION_ID_SEPARATOR);
71 transactionId.append(messageSequence);
73 return transactionId.toString();
76 public String getPublisherId() {
80 public void setPublisherId(String publisherId) {
81 this.publisherId = publisherId;
84 public String getTopicId() {
88 public void setTopicId(String topicId) {
89 this.topicId = topicId;
92 public String getSubscriberGroupId() {
93 return subscriberGroupId;
96 public void setSubscriberGroupId(String subscriberGroupId) {
97 this.subscriberGroupId = subscriberGroupId;
100 public String getSubscriberId() {
104 public void setSubscriberId(String subscriberId) {
105 this.subscriberId = subscriberId;
108 public String getPublisherIp() {
112 public void setPublisherIp(String publisherIp) {
113 this.publisherIp = publisherIp;
116 public String getMessageBatchId() {
117 return messageBatchId;
120 public void setMessageBatchId(Long messageBatchId) {
121 this.messageBatchId = Utils.getFromattedBatchSequenceId(messageBatchId);
124 public String getMessageSequence() {
125 return messageSequence;
128 public void setMessageSequence(String messageSequence) {
129 this.messageSequence = messageSequence;
132 public String getMessageTimestamp() {
133 return messageTimestamp;
136 public void setMessageTimestamp(String messageTimestamp) {
137 this.messageTimestamp = messageTimestamp;
140 public String getPublishTimestamp() {
141 return Utils.getFormattedDate(new Date());
144 public String getConsumeTimestamp() {
145 return consumeTimestamp;
148 public void setConsumeTimestamp(String consumeTimestamp) {
149 this.consumeTimestamp = consumeTimestamp;
152 public long getMessageLengthInBytes() {
153 return messageLengthInBytes;
156 public void setMessageLengthInBytes(long messageLengthInBytes) {
157 this.messageLengthInBytes = messageLengthInBytes;
160 public long getTotalMessageCount() {
161 return totalMessageCount;
164 public void setTotalMessageCount(long totalMessageCount) {
165 this.totalMessageCount = totalMessageCount;
168 public boolean isTransactionEnabled() {
169 return transactionEnabled;
172 public void setTransactionEnabled(boolean transactionEnabled) {
173 this.transactionEnabled = transactionEnabled;
176 public String getTransactionIdTs() {
177 return transactionIdTs;
180 public void setTransactionIdTs(String transactionIdTs) {
181 this.transactionIdTs = transactionIdTs;
184 public String getPublisherLogDetails() {
186 StringBuilder buffer = new StringBuilder();
187 buffer.append("[publisherId=" + publisherId);
188 buffer.append(", topicId=" + topicId);
189 buffer.append(", messageTimestamp=" + messageTimestamp);
190 buffer.append(", publisherIp=" + publisherIp);
191 buffer.append(", messageBatchId=" + messageBatchId);
192 buffer.append(", messageSequence=" + messageSequence );
193 buffer.append(", messageLengthInBytes=" + messageLengthInBytes);
194 buffer.append(", transactionEnabled=" + transactionEnabled);
195 buffer.append(", transactionId=" + getTransactionId());
196 buffer.append(", publishTimestamp=" + getPublishTimestamp());
197 buffer.append(", serverIp=" + getServerIp()+"]");
198 return buffer.toString();
202 public String getServerIp() {
206 public void setServerIp(String serverIp) {
207 this.serverIp = serverIp;
210 public void setMessageBatchId(String messageBatchId) {
211 this.messageBatchId = messageBatchId;