View Javadoc

1   /*
2    * Copyright 2005-2007 The Kuali Foundation
3    * 
4    * 
5    * Licensed under the Educational Community License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    * 
9    * http://www.opensource.org/licenses/ecl2.php
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.kuali.rice.ksb.messaging.bam;
18  
19  import java.io.Serializable;
20  import java.sql.Timestamp;
21  import java.util.ArrayList;
22  import java.util.List;
23  
24  import javax.persistence.Basic;
25  import javax.persistence.CascadeType;
26  import javax.persistence.Column;
27  import javax.persistence.Entity;
28  import javax.persistence.FetchType;
29  import javax.persistence.Id;
30  import javax.persistence.Lob;
31  import javax.persistence.OneToMany;
32  import javax.persistence.PrePersist;
33  import javax.persistence.Table;
34  import javax.persistence.Transient;
35  
36  import org.kuali.rice.core.jpa.annotations.Sequence;
37  import org.kuali.rice.core.util.OrmUtils;
38  import org.kuali.rice.ksb.messaging.AsynchronousCallback;
39  import org.kuali.rice.ksb.service.KSBServiceLocator;
40  
41  
42  /**
43   * An entry in the BAM representing a service method invocation.
44   *
45   * @author Kuali Rice Team (rice.collab@kuali.org)
46   */
47  @Entity
48  @Table(name="KRSB_BAM_T")
49  @Sequence(name="KRSB_BAM_S", property="bamId")
50  public class BAMTargetEntry implements Serializable {
51  
52  	private static final long serialVersionUID = -8376674801367598316L;
53  
54  	@Id
55  	@Column(name="BAM_ID")
56  	private Long bamId;
57  	@Column(name="SVC_NM")
58  	private String serviceName;
59  	@Column(name="MTHD_NM")
60  	private String methodName;
61  	@Column(name="THRD_NM")
62  	private String threadName;
63  	@Column(name="CALL_DT")
64  	private Timestamp callDate;
65  	@Column(name="SVC_URL")
66  	private String serviceURL;
67  	@Column(name="TGT_TO_STR")
68  	private String targetToString;
69  	@Column(name="EXCPN_TO_STR")
70  	private String exceptionToString;
71  	@Lob
72  	@Basic(fetch=FetchType.LAZY)
73  	@Column(name="EXCPN_MSG", length=4000)
74  	private String exceptionMessage;
75  	@Column(name="SRVR_IND")
76  	private Boolean serverInvocation;
77  	@OneToMany(cascade=CascadeType.ALL, mappedBy="bamParamId")
78  	private List<BAMParam> bamParams = new ArrayList<BAMParam>();
79  	
80  	//for async calls not bam
81  	@Transient
82  	private AsynchronousCallback callback;
83  	
84  	@PrePersist
85      public void beforeInsert(){
86          OrmUtils.populateAutoIncValue(this, KSBServiceLocator.getRegistryEntityManagerFactory().createEntityManager());
87      }
88  	
89  	public void addBamParam(BAMParam bamParam) {
90  		this.bamParams.add(bamParam);
91  	}
92  	public String getExceptionToString() {
93  		return this.exceptionToString;
94  	}
95  	public void setExceptionToString(String exceptionToString) {
96  		this.exceptionToString = exceptionToString;
97  	}
98  	public String getServiceName() {
99  		return this.serviceName;
100 	}
101 	public void setServiceName(String serviceName) {
102 		this.serviceName = serviceName;
103 	}
104 	public String getServiceURL() {
105 		return this.serviceURL;
106 	}
107 	public void setServiceURL(String serviceURL) {
108 		this.serviceURL = serviceURL;
109 	}
110 	public String getTargetToString() {
111 		return this.targetToString;
112 	}
113 	public void setTargetToString(String targetToString) {
114 		this.targetToString = targetToString;
115 	}
116 	public Long getBamId() {
117 		return this.bamId;
118 	}
119 	public void setBamId(Long bamId) {
120 		this.bamId = bamId;
121 	}
122 	public String getExceptionMessage() {
123 		return this.exceptionMessage;
124 	}
125 	public void setExceptionMessage(String exceptionMessage) {
126 		this.exceptionMessage = exceptionMessage;
127 	}
128 	public Boolean getServerInvocation() {
129 		return this.serverInvocation;
130 	}
131 	public void setServerInvocation(Boolean clientInvocation) {
132 		this.serverInvocation = clientInvocation;
133 	}
134 	public Timestamp getCallDate() {
135 		return this.callDate;
136 	}
137 	public void setCallDate(Timestamp callDate) {
138 		this.callDate = callDate;
139 	}
140 	public String getMethodName() {
141 		return this.methodName;
142 	}
143 	public void setMethodName(String methodName) {
144 		this.methodName = methodName;
145 	}
146 	public String getThreadName() {
147 		return this.threadName;
148 	}
149 	public void setThreadName(String threadName) {
150 		this.threadName = threadName;
151 	}
152 	public List<BAMParam> getBamParams() {
153 		return this.bamParams;
154 	}
155 	public void setBamParams(List<BAMParam> bamParams) {
156 		this.bamParams = bamParams;
157 	}
158 	public AsynchronousCallback getCallback() {
159 		return this.callback;
160 	}
161 	public void setCallback(AsynchronousCallback callback) {
162 		this.callback = callback;
163 	}
164 }
165