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.apache.commons.lang.StringUtils;
019    import org.hibernate.annotations.GenericGenerator;
020    import org.hibernate.annotations.Parameter;
021    
022    import javax.persistence.CascadeType;
023    import javax.persistence.Column;
024    import javax.persistence.Entity;
025    import javax.persistence.FetchType;
026    import javax.persistence.GeneratedValue;
027    import javax.persistence.Id;
028    import javax.persistence.JoinColumn;
029    import javax.persistence.Lob;
030    import javax.persistence.ManyToOne;
031    import 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")
041    public 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    }