001/**
002 * Copyright 2005-2017 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.ksb.messaging.bam;
017
018import org.kuali.rice.krad.data.jpa.converters.Boolean01Converter;
019import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
020import org.kuali.rice.ksb.api.messaging.AsynchronousCallback;
021
022import javax.persistence.Basic;
023import javax.persistence.CascadeType;
024import javax.persistence.Column;
025import javax.persistence.Convert;
026import javax.persistence.Entity;
027import javax.persistence.FetchType;
028import javax.persistence.GeneratedValue;
029import javax.persistence.Id;
030import javax.persistence.Lob;
031import javax.persistence.OneToMany;
032import javax.persistence.Table;
033import javax.persistence.Transient;
034import java.io.Serializable;
035import java.sql.Timestamp;
036import java.util.ArrayList;
037import java.util.List;
038
039/**
040 * An entry in the BAM representing a service method invocation.
041 *
042 * @author Kuali Rice Team (rice.collab@kuali.org)
043 */
044@Entity
045@Table(name = "KRSB_BAM_T")
046public class BAMTargetEntry implements Serializable {
047
048        private static final long serialVersionUID = -8376674801367598316L;
049
050        @Id
051        @GeneratedValue(generator = "KRSB_BAM_S")
052    @PortableSequenceGenerator(name = "KRSB_BAM_S")
053        @Column(name = "BAM_ID")
054        private Long bamId;
055
056        @Column(name = "SVC_NM")
057        private String serviceName;
058
059        @Column(name = "MTHD_NM")
060        private String methodName;
061
062        @Column(name = "THRD_NM")
063        private String threadName;
064
065        @Column(name = "CALL_DT")
066        private Timestamp callDate;
067
068        @Column(name = "SVC_URL")
069        private String serviceURL;
070
071        @Column(name = "TGT_TO_STR")
072        private String targetToString;
073
074        @Column(name = "EXCPN_TO_STR")
075        private String exceptionToString;
076
077        @Lob
078        @Basic(fetch = FetchType.LAZY)
079        @Column(name = "EXCPN_MSG", length=4000)
080        private String exceptionMessage;
081
082        @Column(name = "SRVR_IND")
083    @Convert(converter = Boolean01Converter.class)
084        private Boolean serverInvocation;
085
086        @OneToMany(cascade = CascadeType.ALL, mappedBy = "bamTargetEntry")
087        private List<BAMParam> bamParams = new ArrayList<BAMParam>();
088        
089        //for async calls not bam
090        @Transient
091        private AsynchronousCallback callback;
092                
093        public void addBamParam(BAMParam bamParam) {
094                this.bamParams.add(bamParam);
095        }
096        public String getExceptionToString() {
097                return this.exceptionToString;
098        }
099        public void setExceptionToString(String exceptionToString) {
100                this.exceptionToString = exceptionToString;
101        }
102        public String getServiceName() {
103                return this.serviceName;
104        }
105        public void setServiceName(String serviceName) {
106                this.serviceName = serviceName;
107        }
108        public String getServiceURL() {
109                return this.serviceURL;
110        }
111        public void setServiceURL(String serviceURL) {
112                this.serviceURL = serviceURL;
113        }
114        public String getTargetToString() {
115                return this.targetToString;
116        }
117        public void setTargetToString(String targetToString) {
118                this.targetToString = targetToString;
119        }
120        public Long getBamId() {
121                return this.bamId;
122        }
123        public void setBamId(Long bamId) {
124                this.bamId = bamId;
125        }
126        public String getExceptionMessage() {
127                return this.exceptionMessage;
128        }
129        public void setExceptionMessage(String exceptionMessage) {
130                this.exceptionMessage = exceptionMessage;
131        }
132        public Boolean getServerInvocation() {
133                return this.serverInvocation;
134        }
135        public void setServerInvocation(Boolean clientInvocation) {
136                this.serverInvocation = clientInvocation;
137        }
138        public Timestamp getCallDate() {
139                return this.callDate;
140        }
141        public void setCallDate(Timestamp callDate) {
142                this.callDate = callDate;
143        }
144        public String getMethodName() {
145                return this.methodName;
146        }
147        public void setMethodName(String methodName) {
148                this.methodName = methodName;
149        }
150        public String getThreadName() {
151                return this.threadName;
152        }
153        public void setThreadName(String threadName) {
154                this.threadName = threadName;
155        }
156        public List<BAMParam> getBamParams() {
157                return this.bamParams;
158        }
159        public void setBamParams(List<BAMParam> bamParams) {
160                this.bamParams = bamParams;
161        }
162        public AsynchronousCallback getCallback() {
163                return this.callback;
164        }
165        public void setCallback(AsynchronousCallback callback) {
166                this.callback = callback;
167        }
168}
169