View Javadoc

1   /*
2    * Copyright 2007 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 java.io.Serializable;
19  
20  import javax.persistence.AttributeOverride;
21  import javax.persistence.AttributeOverrides;
22  import javax.persistence.Column;
23  import javax.persistence.Entity;
24  import javax.persistence.FetchType;
25  import javax.persistence.GeneratedValue;
26  import javax.persistence.GenerationType;
27  import javax.persistence.Id;
28  import javax.persistence.JoinColumn;
29  import javax.persistence.ManyToOne;
30  import javax.persistence.PrePersist;
31  import javax.persistence.SequenceGenerator;
32  import javax.persistence.Table;
33  
34  import org.apache.commons.lang.builder.ToStringBuilder;
35  
36  /**
37   * A route node definition configuration parameter.  RouteNodeConfigParameters are
38   * extracted when the route node is parsed, and depend on route node implementation.
39   * (well, they actually depend on the route node parser because the parser is what
40   * will parse them, but the parser is not specialized per-node-type at this point) 
41   * @author Kuali Rice Team (rice.collab@kuali.org)
42   *
43   */
44  @Entity
45  @Table(name="KREW_RTE_NODE_CFG_PARM_T")
46  @AttributeOverrides({@AttributeOverride(name="key", column=@Column(name="KEY_CD")), @AttributeOverride(name="value", column=@Column(name="VAL"))})
47  public class RouteNodeConfigParam extends KeyValuePair implements Serializable {
48      private static final long serialVersionUID = 5592421070149273014L;
49  
50      /**
51       * Primary key
52       */
53      @Id
54  	@Column(name="RTE_NODE_CFG_PARM_ID")
55  	@GeneratedValue(strategy=GenerationType.AUTO, generator="KREW_RTE_NODE_CFG_PARM_SEQ_GEN")
56      @SequenceGenerator(name="KREW_RTE_NODE_CFG_PARM_SEQ_GEN", sequenceName="KREW_RTE_NODE_CFG_PARM_S")	
57  	private Long id;
58      /**
59       * Foreign key to routenode table
60       */
61      @ManyToOne(fetch=FetchType.EAGER)
62  	@JoinColumn(name="RTE_NODE_ID")
63  	private RouteNode routeNode;
64  
65      public RouteNodeConfigParam() {}
66  
67      public RouteNodeConfigParam(RouteNode routeNode, String key, String value) {
68          super(key, value);
69          this.routeNode = routeNode;
70      }
71  
72      /**
73       * @return the id
74       */
75      public Long getId() {
76          return this.id;
77      }
78      /**
79       * @param id the id to set
80       */
81      public void setId(Long id) {
82          this.id = id;
83      }
84      /**
85       * @return the routeNode
86       */
87      public RouteNode getRouteNode() {
88          return this.routeNode;
89      }
90      /**
91       * @param routeNode the routeNode to set
92       */
93      public void setRouteNode(RouteNode routeNode) {
94          this.routeNode = routeNode;
95      }
96  
97      public String toString() {
98          return new ToStringBuilder(this).append("id", id)
99                                          .append("routeNode", routeNode == null ? null : routeNode.getRouteNodeId())
100                                         .append("key", key)
101                                         .append("value", value)
102                                         .toString();
103     }
104     
105 }