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