View Javadoc

1   /**
2    * Copyright 2005-2011 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.ksb.messaging.bam;
17  
18  import javax.persistence.CascadeType;
19  import javax.persistence.Column;
20  import javax.persistence.Entity;
21  import javax.persistence.FetchType;
22  import javax.persistence.GeneratedValue;
23  import javax.persistence.Id;
24  import javax.persistence.JoinColumn;
25  import javax.persistence.Lob;
26  import javax.persistence.ManyToOne;
27  import javax.persistence.Table;
28  
29  import org.apache.commons.lang.StringUtils;
30  import org.hibernate.annotations.GenericGenerator;
31  import org.hibernate.annotations.Parameter;
32  import org.kuali.rice.core.framework.persistence.jpa.OrmUtils;
33  import org.kuali.rice.ksb.service.KSBServiceLocator;
34  
35  /**
36   * A parameter of a method invocation recorded by the BAM.
37   *
38   * @author Kuali Rice Team (rice.collab@kuali.org)
39   */
40  @Entity
41  @Table(name="KRSB_BAM_PARM_T")
42  //@Sequence(name="KRSB_BAM_PARM_S", property="bamParamId")
43  public class BAMParam {
44  
45  	@Id
46  	@GeneratedValue(generator="KRSB_BAM_PARM_S")
47  	@GenericGenerator(name="KRSB_BAM_PARM_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={
48  			@Parameter(name="sequence_name",value="KRSB_BAM_PARM_S"),
49  			@Parameter(name="value_column",value="id")
50  	})
51  	@Column(name="BAM_PARM_ID")
52  	private Long bamParamId;
53  	@ManyToOne(fetch=FetchType.EAGER, cascade={CascadeType.PERSIST})
54  	@JoinColumn(name="BAM_ID")
55  	private BAMTargetEntry bamTargetEntry;
56  	@Lob
57  	@Column(name="PARM")
58  	private String param;
59  	
60  	//@PrePersist
61      public void beforeInsert(){
62  	    OrmUtils.populateAutoIncValue(this, KSBServiceLocator.getRegistryEntityManagerFactory().createEntityManager());
63      }
64  	
65  	public BAMTargetEntry getBamTargetEntry() {
66  		return this.bamTargetEntry;
67  	}
68  	public void setBamTargetEntry(BAMTargetEntry bamTargetEntry) {
69  		this.bamTargetEntry = bamTargetEntry;
70  	}
71  	public Long getBamParamId() {
72  		return this.bamParamId;
73  	}
74  	public void setBamParamId(Long bamParamId) {
75  		this.bamParamId = bamParamId;
76  	}
77  	public String getParam() {
78  		return this.param;
79  	}
80  	public void setParam(String paramToString) {
81  		if (StringUtils.isEmpty(paramToString)) {
82  			paramToString = "<null>";//oracle blows null constraint on empty strings
83  		}
84  		this.param = paramToString;
85  	}
86  }