001 /** 002 * Copyright 2005-2014 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.kew.engine.node; 017 018 import org.kuali.rice.core.api.util.KeyValue; 019 import org.kuali.rice.kew.api.doctype.RouteNodeConfigurationParameterContract; 020 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase; 021 import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator; 022 023 import javax.persistence.AttributeOverride; 024 import javax.persistence.AttributeOverrides; 025 import javax.persistence.Column; 026 import javax.persistence.Entity; 027 import javax.persistence.FetchType; 028 import javax.persistence.GeneratedValue; 029 import javax.persistence.Id; 030 import javax.persistence.JoinColumn; 031 import javax.persistence.ManyToOne; 032 import javax.persistence.Table; 033 034 /** 035 * A route node definition configuration parameter. RouteNodeConfigParameters are 036 * extracted when the route node is parsed, and depend on route node implementation. 037 * (well, they actually depend on the route node parser because the parser is what 038 * will parse them, but the parser is not specialized per-node-type at this point) 039 * @author Kuali Rice Team (rice.collab@kuali.org) 040 * 041 */ 042 @Entity 043 @Table(name="KREW_RTE_NODE_CFG_PARM_T") 044 @AttributeOverrides({@AttributeOverride(name="key", column=@Column(name="KEY_CD")), @AttributeOverride(name="value", column=@Column(name="VAL")), 045 @AttributeOverride(name="objectId",column=@Column(name="KEY_CD", insertable = false, updatable = false)), 046 @AttributeOverride(name="versionNumber", column=@Column(name="KEY_CD", updatable=false, insertable=false))}) 047 public class RouteNodeConfigParam extends PersistableBusinessObjectBase implements KeyValue, RouteNodeConfigurationParameterContract { 048 private static final long serialVersionUID = 5592421070149273014L; 049 050 /** 051 * Primary key 052 */ 053 @Id 054 @Column(name="RTE_NODE_CFG_PARM_ID") 055 @PortableSequenceGenerator(name="KREW_RTE_NODE_CFG_PARM_S") 056 @GeneratedValue(generator="KREW_RTE_NODE_CFG_PARM_S") 057 private String id; 058 private String key; 059 private String value; 060 /** 061 * Foreign key to routenode table 062 */ 063 @ManyToOne(fetch=FetchType.EAGER) 064 @JoinColumn(name="RTE_NODE_ID") 065 private RouteNode routeNode; 066 067 private String versionNumber; 068 069 public RouteNodeConfigParam() {} 070 071 public RouteNodeConfigParam(RouteNode routeNode, String key, String value) { 072 this.key = key; 073 this.value = value; 074 this.routeNode = routeNode; 075 } 076 077 /** 078 * @return the id 079 */ 080 @Override 081 public String getId() { 082 return this.id; 083 } 084 /** 085 * @param id the id to set 086 */ 087 public void setId(String id) { 088 this.id = id; 089 } 090 /** 091 * @return the routeNode 092 */ 093 public RouteNode getRouteNode() { 094 return this.routeNode; 095 } 096 /** 097 * @param routeNode the routeNode to set 098 */ 099 public void setRouteNode(RouteNode routeNode) { 100 this.routeNode = routeNode; 101 } 102 103 @Override 104 public String getKey() { 105 return key; 106 } 107 108 @Override 109 public String getValue() { 110 return value; 111 } 112 113 public void setKey(String key) { 114 this.key = key; 115 } 116 117 public void setValue(String value) { 118 this.value = value; 119 } 120 121 @Override 122 public String getRouteNodeId() { 123 if (routeNode == null || routeNode.getRouteNodeId() == null) { 124 return null; 125 } 126 return routeNode.getRouteNodeId().toString(); 127 } 128 129 130 }