001/**
002 * Copyright 2005-2015 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 */
016package org.kuali.rice.kew.engine.node;
017
018import org.kuali.rice.core.api.util.KeyValue;
019import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
020import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
021
022import javax.persistence.AttributeOverride;
023import javax.persistence.Column;
024import javax.persistence.GeneratedValue;
025import javax.persistence.Id;
026import javax.persistence.MappedSuperclass;
027
028/**
029 * A KeyValuePair that adds an id fields that makes it sufficient for storing in a database.
030 * 
031 * @author Kuali Rice Team (rice.collab@kuali.org)
032 */
033@MappedSuperclass
034@AttributeOverride(name="objectId", column=@Column(name="VAL", updatable = false, insertable = false))
035public abstract class State extends PersistableBusinessObjectBase implements KeyValue {
036    @Id
037    @PortableSequenceGenerator(name="KREW_RTE_NODE_S")
038    @GeneratedValue(generator="KREW_RTE_NODE_S")
039        protected String stateId;
040    @Column(name="KEY_CD")
041        private String key;
042    @Column(name="VAL")
043    private String value;
044
045    public State() {}
046    
047    public State(String key, String value) {
048        this.key = key;
049        this.value = value;
050    }
051
052    public String getStateId() {
053        return stateId;
054    }
055
056    public void setStateId(String stateId) {
057        this.stateId = stateId;
058    }
059    
060    @Override
061    public String getKey() {
062        return key;
063    }
064    
065    @Override
066    public String getValue() {
067        return value;
068    }
069    
070    public void setKey(String key) {
071                this.key = key;
072        }
073
074        public void setValue(String value) {
075                this.value = value;
076        }
077
078    @Override
079    public String toString(){
080        return "stateId: " +getStateId();
081    }
082}