001    /**
002     * Copyright 2005-2012 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     */
016    package org.kuali.rice.ksb.messaging.bam;
017    
018    import org.hibernate.annotations.GenericGenerator;
019    import org.hibernate.annotations.Parameter;
020    import org.kuali.rice.ksb.api.messaging.AsynchronousCallback;
021    
022    import javax.persistence.Basic;
023    import javax.persistence.CascadeType;
024    import javax.persistence.Column;
025    import javax.persistence.Entity;
026    import javax.persistence.FetchType;
027    import javax.persistence.GeneratedValue;
028    import javax.persistence.Id;
029    import javax.persistence.Lob;
030    import javax.persistence.OneToMany;
031    import javax.persistence.Table;
032    import javax.persistence.Transient;
033    import java.io.Serializable;
034    import java.sql.Timestamp;
035    import java.util.ArrayList;
036    import java.util.List;
037    
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")
046    //@Sequence(name="KRSB_BAM_S", property="bamId")
047    public class BAMTargetEntry implements Serializable {
048    
049            private static final long serialVersionUID = -8376674801367598316L;
050    
051            @Id
052            @GeneratedValue(generator="KRSB_BAM_S")
053            @GenericGenerator(name="KRSB_BAM_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={
054                            @Parameter(name="sequence_name",value="KRSB_BAM_S"),
055                            @Parameter(name="value_column",value="id")
056            })
057            @Column(name="BAM_ID")
058            private Long bamId;
059            @Column(name="SVC_NM")
060            private String serviceName;
061            @Column(name="MTHD_NM")
062            private String methodName;
063            @Column(name="THRD_NM")
064            private String threadName;
065            @Column(name="CALL_DT")
066            private Timestamp callDate;
067            @Column(name="SVC_URL")
068            private String serviceURL;
069            @Column(name="TGT_TO_STR")
070            private String targetToString;
071            @Column(name="EXCPN_TO_STR")
072            private String exceptionToString;
073            @Lob
074            @Basic(fetch=FetchType.LAZY)
075            @Column(name="EXCPN_MSG", length=4000)
076            private String exceptionMessage;
077            @Column(name="SRVR_IND")
078            private Boolean serverInvocation;
079            @OneToMany(cascade=CascadeType.ALL, mappedBy="bamParamId")
080            private List<BAMParam> bamParams = new ArrayList<BAMParam>();
081            
082            //for async calls not bam
083            @Transient
084            private AsynchronousCallback callback;
085                    
086            public void addBamParam(BAMParam bamParam) {
087                    this.bamParams.add(bamParam);
088            }
089            public String getExceptionToString() {
090                    return this.exceptionToString;
091            }
092            public void setExceptionToString(String exceptionToString) {
093                    this.exceptionToString = exceptionToString;
094            }
095            public String getServiceName() {
096                    return this.serviceName;
097            }
098            public void setServiceName(String serviceName) {
099                    this.serviceName = serviceName;
100            }
101            public String getServiceURL() {
102                    return this.serviceURL;
103            }
104            public void setServiceURL(String serviceURL) {
105                    this.serviceURL = serviceURL;
106            }
107            public String getTargetToString() {
108                    return this.targetToString;
109            }
110            public void setTargetToString(String targetToString) {
111                    this.targetToString = targetToString;
112            }
113            public Long getBamId() {
114                    return this.bamId;
115            }
116            public void setBamId(Long bamId) {
117                    this.bamId = bamId;
118            }
119            public String getExceptionMessage() {
120                    return this.exceptionMessage;
121            }
122            public void setExceptionMessage(String exceptionMessage) {
123                    this.exceptionMessage = exceptionMessage;
124            }
125            public Boolean getServerInvocation() {
126                    return this.serverInvocation;
127            }
128            public void setServerInvocation(Boolean clientInvocation) {
129                    this.serverInvocation = clientInvocation;
130            }
131            public Timestamp getCallDate() {
132                    return this.callDate;
133            }
134            public void setCallDate(Timestamp callDate) {
135                    this.callDate = callDate;
136            }
137            public String getMethodName() {
138                    return this.methodName;
139            }
140            public void setMethodName(String methodName) {
141                    this.methodName = methodName;
142            }
143            public String getThreadName() {
144                    return this.threadName;
145            }
146            public void setThreadName(String threadName) {
147                    this.threadName = threadName;
148            }
149            public List<BAMParam> getBamParams() {
150                    return this.bamParams;
151            }
152            public void setBamParams(List<BAMParam> bamParams) {
153                    this.bamParams = bamParams;
154            }
155            public AsynchronousCallback getCallback() {
156                    return this.callback;
157            }
158            public void setCallback(AsynchronousCallback callback) {
159                    this.callback = callback;
160            }
161    }
162