View Javadoc
1   /**
2    * Copyright 2005-2014 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.krad.bo.PersistableBusinessObjectBase;
20  import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
21  
22  import javax.persistence.AttributeOverride;
23  import javax.persistence.Column;
24  import javax.persistence.GeneratedValue;
25  import javax.persistence.Id;
26  import javax.persistence.MappedSuperclass;
27  
28  /**
29   * A KeyValuePair that adds an id fields that makes it sufficient for storing in a database.
30   * 
31   * @author Kuali Rice Team (rice.collab@kuali.org)
32   */
33  @MappedSuperclass
34  @AttributeOverride(name="objectId", column=@Column(name="VAL", updatable = false, insertable = false))
35  public abstract class State extends PersistableBusinessObjectBase implements KeyValue {
36      @Id
37      @PortableSequenceGenerator(name="KREW_RTE_NODE_S")
38      @GeneratedValue(generator="KREW_RTE_NODE_S")
39  	protected String stateId;
40      @Column(name="KEY_CD")
41  	private String key;
42      @Column(name="VAL")
43      private String value;
44  
45      public State() {}
46      
47      public State(String key, String value) {
48      	this.key = key;
49      	this.value = value;
50      }
51  
52      public String getStateId() {
53          return stateId;
54      }
55  
56      public void setStateId(String stateId) {
57          this.stateId = stateId;
58      }
59      
60      @Override
61      public String getKey() {
62      	return key;
63      }
64      
65      @Override
66      public String getValue() {
67      	return value;
68      }
69      
70      public void setKey(String key) {
71  		this.key = key;
72  	}
73  
74  	public void setValue(String value) {
75  		this.value = value;
76  	}
77  
78      @Override
79      public String toString(){
80          return "stateId: " +getStateId();
81      }
82  }