001/**
002 * Copyright 2005-2016 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.apache.commons.lang.StringUtils;
019import org.hibernate.annotations.GenericGenerator;
020import org.hibernate.annotations.Parameter;
021
022import javax.persistence.CascadeType;
023import javax.persistence.Column;
024import javax.persistence.Entity;
025import javax.persistence.FetchType;
026import javax.persistence.GeneratedValue;
027import javax.persistence.Id;
028import javax.persistence.JoinColumn;
029import javax.persistence.Lob;
030import javax.persistence.ManyToOne;
031import javax.persistence.Table;
032
033/**
034 * A parameter of a method invocation recorded by the BAM.
035 *
036 * @author Kuali Rice Team (rice.collab@kuali.org)
037 */
038@Entity
039@Table(name="KRSB_BAM_PARM_T")
040//@Sequence(name="KRSB_BAM_PARM_S", property="bamParamId")
041public class BAMParam {
042
043        @Id
044        @GeneratedValue(generator="KRSB_BAM_PARM_S")
045        @GenericGenerator(name="KRSB_BAM_PARM_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={
046                        @Parameter(name="sequence_name",value="KRSB_BAM_PARM_S"),
047                        @Parameter(name="value_column",value="id")
048        })
049        @Column(name="BAM_PARM_ID")
050        private Long bamParamId;
051        @ManyToOne(fetch=FetchType.EAGER, cascade={CascadeType.PERSIST})
052        @JoinColumn(name="BAM_ID")
053        private BAMTargetEntry bamTargetEntry;
054        @Lob
055        @Column(name="PARM")
056        private String param;
057                
058        public BAMTargetEntry getBamTargetEntry() {
059                return this.bamTargetEntry;
060        }
061        public void setBamTargetEntry(BAMTargetEntry bamTargetEntry) {
062                this.bamTargetEntry = bamTargetEntry;
063        }
064        public Long getBamParamId() {
065                return this.bamParamId;
066        }
067        public void setBamParamId(Long bamParamId) {
068                this.bamParamId = bamParamId;
069        }
070        public String getParam() {
071                return this.param;
072        }
073        public void setParam(String paramToString) {
074                if (StringUtils.isEmpty(paramToString)) {
075                        paramToString = "<null>";//oracle blows null constraint on empty strings
076                }
077                this.param = paramToString;
078        }
079}