001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.camel.processor.interceptor.jpa;
018
019 import java.util.Date;
020 import javax.persistence.Entity;
021 import javax.persistence.GeneratedValue;
022 import javax.persistence.Id;
023 import javax.persistence.Table;
024
025 import org.apache.camel.processor.interceptor.TraceEventMessage;
026
027 /**
028 * A JPA based {@link org.apache.camel.processor.interceptor.TraceEventMessage} that is capable of persisting
029 * trace event into a database.
030 */
031 @Entity
032 @Table(
033 name = "CAMEL_MESSAGETRACED"
034 )
035 public class JpaTraceEventMessage implements TraceEventMessage {
036
037 protected Long id;
038 protected Date timestamp;
039 protected String fromEndpointUri;
040 protected String previousNode;
041 protected String toNode;
042 protected String exchangeId;
043 protected String shortExchangeId;
044 protected String exchangePattern;
045 protected String properties;
046 protected String headers;
047 protected String body;
048 protected String bodyType;
049 protected String outHeaders;
050 protected String outBody;
051 protected String outBodyType;
052 protected String causedByException;
053
054 public JpaTraceEventMessage() {
055 }
056
057 @Id
058 @GeneratedValue
059 public Long getId() {
060 return id;
061 }
062
063 public void setId(Long id) {
064 this.id = id;
065 }
066
067 public Date getTimestamp() {
068 return timestamp;
069 }
070
071 public void setTimestamp(Date timestamp) {
072 this.timestamp = timestamp;
073 }
074
075 public String getPreviousNode() {
076 return previousNode;
077 }
078
079 public void setPreviousNode(String previousNode) {
080 this.previousNode = previousNode;
081 }
082
083 public String getFromEndpointUri() {
084 return fromEndpointUri;
085 }
086
087 public void setFromEndpointUri(String fromEndpointUri) {
088 this.fromEndpointUri = fromEndpointUri;
089 }
090
091 public String getToNode() {
092 return toNode;
093 }
094
095 public void setToNode(String toNode) {
096 this.toNode = toNode;
097 }
098
099 public String getExchangeId() {
100 return exchangeId;
101 }
102
103 public void setExchangeId(String exchangeId) {
104 this.exchangeId = exchangeId;
105 }
106
107 public String getShortExchangeId() {
108 return shortExchangeId;
109 }
110
111 public void setShortExchangeId(String shortExchangeId) {
112 this.shortExchangeId = shortExchangeId;
113 }
114
115 public String getExchangePattern() {
116 return exchangePattern;
117 }
118
119 public void setExchangePattern(String exchangePattern) {
120 this.exchangePattern = exchangePattern;
121 }
122
123 public String getProperties() {
124 return properties;
125 }
126
127 public void setProperties(String properties) {
128 this.properties = properties;
129 }
130
131 public String getHeaders() {
132 return headers;
133 }
134
135 public void setHeaders(String headers) {
136 this.headers = headers;
137 }
138
139 public String getBody() {
140 return body;
141 }
142
143 public void setBody(String body) {
144 this.body = body;
145 }
146
147 public String getBodyType() {
148 return bodyType;
149 }
150
151 public void setBodyType(String bodyType) {
152 this.bodyType = bodyType;
153 }
154
155 public String getOutBody() {
156 return outBody;
157 }
158
159 public void setOutBody(String outBody) {
160 this.outBody = outBody;
161 }
162
163 public String getOutBodyType() {
164 return outBodyType;
165 }
166
167 public void setOutBodyType(String outBodyType) {
168 this.outBodyType = outBodyType;
169 }
170
171 public String getOutHeaders() {
172 return outHeaders;
173 }
174
175 public void setOutHeaders(String outHeaders) {
176 this.outHeaders = outHeaders;
177 }
178
179 public String getCausedByException() {
180 return causedByException;
181 }
182
183 public void setCausedByException(String causedByException) {
184 this.causedByException = causedByException;
185 }
186
187 @Override
188 public String toString() {
189 return "TraceEventMessage[" + getExchangeId() + "] on node: " + getToNode();
190 }
191
192 }