001 /* 002 * Copyright 2006-2009 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.kns.bo; 017 018 import java.util.LinkedHashMap; 019 020 import javax.persistence.CascadeType; 021 import javax.persistence.Column; 022 import javax.persistence.Entity; 023 import javax.persistence.FetchType; 024 import javax.persistence.Id; 025 import javax.persistence.IdClass; 026 import javax.persistence.JoinColumn; 027 import javax.persistence.JoinColumns; 028 import javax.persistence.ManyToOne; 029 import javax.persistence.OneToOne; 030 import javax.persistence.Table; 031 032 import org.kuali.rice.kns.util.KNSConstants; 033 034 /** 035 * 036 */ 037 @IdClass(org.kuali.rice.kns.bo.ParameterId.class) 038 @Entity 039 @Table(name="KRNS_PARM_T") 040 public class Parameter extends PersistableBusinessObjectBase { 041 042 private static final long serialVersionUID = 4874830226334867797L; 043 044 @Id 045 @Column(name="NMSPC_CD") 046 private String parameterNamespaceCode; 047 048 @Id 049 @Column(name="PARM_DTL_TYP_CD") 050 private String parameterDetailTypeCode; 051 052 @Id 053 @Column(name="PARM_NM") 054 private String parameterName; 055 056 @Id 057 @Column(name="APPL_NMSPC_CD") 058 private String parameterApplicationNamespaceCode; 059 060 @Column(name="TXT") 061 private String parameterValue; 062 063 @Column(name="PARM_DESC_TXT", length=2048) 064 private String parameterDescription; 065 066 @Column(name="PARM_TYP_CD") 067 private String parameterTypeCode; 068 069 @Column(name="CONS_CD") 070 private String parameterConstraintCode; 071 072 073 074 @ManyToOne(fetch=FetchType.LAZY, cascade={CascadeType.PERSIST}) 075 @JoinColumn(name="NMSPC_CD", insertable=false, updatable=false) 076 private Namespace parameterNamespace; 077 078 @OneToOne(fetch=FetchType.LAZY, cascade={CascadeType.PERSIST}) 079 @JoinColumn(name="PARM_TYP_CD", insertable=false, updatable=false) 080 private ParameterType parameterType; 081 082 @ManyToOne(fetch=FetchType.LAZY, cascade={CascadeType.PERSIST}) 083 @JoinColumns({@JoinColumn(name="NMSPC_CD", insertable=false, updatable=false), @JoinColumn(name="PARM_DTL_TYP_CD", insertable=false, updatable=false)}) 084 private ParameterDetailType parameterDetailType; 085 086 public Parameter() { 087 088 } 089 090 public Parameter( String parameterName, String parameterValue, String parameterConstraintCode ) { 091 this.parameterName = parameterName; 092 this.parameterValue = parameterValue; 093 this.parameterConstraintCode = parameterConstraintCode; 094 this.parameterApplicationNamespaceCode = KNSConstants.DEFAULT_APPLICATION_CODE; 095 } 096 097 public Parameter( String parameterName, String parameterValue, String parameterConstraintCode, String parameterApplicationNamespaceCode ) { 098 this.parameterName = parameterName; 099 this.parameterValue = parameterValue; 100 this.parameterConstraintCode = parameterConstraintCode; 101 this.parameterApplicationNamespaceCode = parameterApplicationNamespaceCode; 102 } 103 104 105 public String getParameterName() { 106 return parameterName; 107 } 108 109 public void setParameterName(String parameterName) { 110 this.parameterName = parameterName; 111 } 112 113 public String getParameterValue() { 114 return parameterValue; 115 } 116 117 public void setParameterValue(String parameterValue) { 118 this.parameterValue = parameterValue; 119 } 120 121 public String getParameterDescription() { 122 return parameterDescription; 123 } 124 125 public void setParameterDescription(String parameterDescription) { 126 this.parameterDescription = parameterDescription; 127 } 128 129 public String getParameterTypeCode() { 130 return parameterTypeCode; 131 } 132 133 public void setParameterTypeCode(String parameterTypeCode) { 134 this.parameterTypeCode = parameterTypeCode; 135 } 136 137 public String getParameterConstraintCode() { 138 return parameterConstraintCode; 139 } 140 141 public void setParameterConstraintCode(String parameterConstraintCode) { 142 this.parameterConstraintCode = parameterConstraintCode; 143 } 144 145 146 /** 147 * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper() 148 */ 149 protected LinkedHashMap toStringMapper() { 150 LinkedHashMap m = new LinkedHashMap(); 151 m.put( "parameterNamespaceCode", this.parameterNamespaceCode ); 152 m.put( "parameterDetailTypeCode", this.parameterDetailTypeCode ); 153 m.put( "parameterApplicationNamespaceCode", this.parameterApplicationNamespaceCode ); 154 m.put( "parameterName", this.parameterName ); 155 m.put( "parameterValue", this.parameterValue ); 156 m.put( "parameterConstraintCode", this.getParameterConstraintCode() ); 157 return m; 158 } 159 160 public ParameterType getParameterType() { 161 return parameterType; 162 } 163 164 public void setParameterType(ParameterType parameterType) { 165 this.parameterType = parameterType; 166 } 167 168 public String getParameterNamespaceCode() { 169 return parameterNamespaceCode; 170 } 171 172 public void setParameterNamespaceCode(String parameterNamespaceCode) { 173 this.parameterNamespaceCode = parameterNamespaceCode; 174 } 175 176 public String getParameterDetailTypeCode() { 177 return parameterDetailTypeCode; 178 } 179 180 public void setParameterDetailTypeCode(String parameterDetailTypeCode) { 181 this.parameterDetailTypeCode = parameterDetailTypeCode; 182 } 183 184 public Namespace getParameterNamespace() { 185 return parameterNamespace; 186 } 187 188 public void setParameterNamespace(Namespace parameterNamespace) { 189 this.parameterNamespace = parameterNamespace; 190 } 191 192 public ParameterDetailType getParameterDetailType() { 193 return parameterDetailType; 194 } 195 196 public void setParameterDetailType(ParameterDetailType parameterDetailType) { 197 this.parameterDetailType = parameterDetailType; 198 } 199 200 public String getParameterApplicationNamespaceCode() { 201 return this.parameterApplicationNamespaceCode; 202 } 203 204 public void setParameterApplicationNamespaceCode(String parameterApplicationNamespaceCode) { 205 this.parameterApplicationNamespaceCode = parameterApplicationNamespaceCode; 206 } 207 208 } 209