001/**
002 * Copyright 2005-2016 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 javax.persistence.*;
019
020/**
021 * The state of a {@link RouteNodeInstance} represented as a key-value pair of Strings.
022 *
023 * @author Kuali Rice Team (rice.collab@kuali.org)
024 */
025@Entity
026@Table(name="KREW_RTE_NODE_INSTN_ST_T")
027@AttributeOverride(name="stateId", column=@Column(name="RTE_NODE_INSTN_ST_ID"))
028@NamedQueries({
029        @NamedQuery(name="NodeState.FindNodeState", query="select n from NodeState as n where n.nodeInstance.routeNodeInstanceId = :routeNodeInstanceId and n.key = :key"),
030        @NamedQuery(name="NodeState.FindNodeStateById", query="select n from NodeState as n where n.stateId = :nodeStateId")
031})
032public class NodeState extends State {
033
034    private static final long serialVersionUID = -4382379569851955918L;
035
036    @ManyToOne(fetch=FetchType.EAGER)
037        @JoinColumn(name="RTE_NODE_INSTN_ID")
038        private RouteNodeInstance nodeInstance;
039    @Version
040        @Column(name="VER_NBR")
041        private Integer lockVerNbr;
042    
043    public NodeState() {}
044    
045    public NodeState(String key, String value) {
046        super(key, value);
047    }
048    
049    
050    public RouteNodeInstance getNodeInstance() {
051        return nodeInstance;
052    }
053    public void setNodeInstance(RouteNodeInstance nodeInstance) {
054        this.nodeInstance = nodeInstance;
055    }
056
057    public String getNodeStateId() {
058        return getStateId();
059    }
060
061    public void setNodeStateId(String nodeStateId) {
062        setStateId(nodeStateId);
063    }
064
065    public Integer getLockVerNbr() {
066        return lockVerNbr;
067    }
068
069    public void setLockVerNbr(Integer lockVerNbr) {
070        this.lockVerNbr = lockVerNbr;
071    }
072}