View Javadoc
1   /**
2    * Copyright 2005-2015 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.kew.engine.node;
17  
18  import org.kuali.rice.core.api.util.KeyValue;
19  import org.kuali.rice.kew.api.doctype.RouteNodeConfigurationParameterContract;
20  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
21  import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
22  
23  import javax.persistence.AttributeOverride;
24  import javax.persistence.AttributeOverrides;
25  import javax.persistence.Column;
26  import javax.persistence.Entity;
27  import javax.persistence.FetchType;
28  import javax.persistence.GeneratedValue;
29  import javax.persistence.Id;
30  import javax.persistence.JoinColumn;
31  import javax.persistence.ManyToOne;
32  import javax.persistence.Table;
33  
34  /**
35   * A route node definition configuration parameter.  RouteNodeConfigParameters are
36   * extracted when the route node is parsed, and depend on route node implementation.
37   * (well, they actually depend on the route node parser because the parser is what
38   * will parse them, but the parser is not specialized per-node-type at this point) 
39   * @author Kuali Rice Team (rice.collab@kuali.org)
40   *
41   */
42  @Entity
43  @Table(name="KREW_RTE_NODE_CFG_PARM_T")
44  @AttributeOverrides({@AttributeOverride(name="key", column=@Column(name="KEY_CD")), @AttributeOverride(name="value", column=@Column(name="VAL")),
45      @AttributeOverride(name="objectId",column=@Column(name="KEY_CD", insertable = false, updatable = false)),
46          @AttributeOverride(name="versionNumber", column=@Column(name="KEY_CD", updatable=false, insertable=false))})
47  public class RouteNodeConfigParam extends PersistableBusinessObjectBase implements KeyValue, RouteNodeConfigurationParameterContract {
48      private static final long serialVersionUID = 5592421070149273014L;
49  
50      /**
51       * Primary key
52       */ 
53      @Id
54  	@Column(name="RTE_NODE_CFG_PARM_ID")
55      @PortableSequenceGenerator(name="KREW_RTE_NODE_CFG_PARM_S")
56  	@GeneratedValue(generator="KREW_RTE_NODE_CFG_PARM_S")
57  	private String id;
58  	private String key;
59      private String value;
60      /**
61       * Foreign key to routenode table
62       */
63      @ManyToOne(fetch=FetchType.EAGER)
64  	@JoinColumn(name="RTE_NODE_ID")
65  	private RouteNode routeNode;
66  
67      private String versionNumber;
68  
69      public RouteNodeConfigParam() {}
70  
71      public RouteNodeConfigParam(RouteNode routeNode, String key, String value) {
72      	this.key = key;
73      	this.value = value;
74          this.routeNode = routeNode;
75      }
76  
77      /**
78       * @return the id
79       */
80      @Override
81      public String getId() {
82  		return this.id;
83      }
84      /**
85       * @param id the id to set
86       */
87      public void setId(String id) {
88          this.id = id;
89      }
90      /**
91       * @return the routeNode
92       */
93      public RouteNode getRouteNode() {
94          return this.routeNode;
95      }
96      /**
97       * @param routeNode the routeNode to set
98       */
99      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 }