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 * A piece of state on a {@link Branch} stored 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_BRCH_ST_T")
027@AttributeOverride(name="stateId", column=@Column(name="RTE_BRCH_ST_ID"))
028public class BranchState extends State {
029    /**
030     * Prefix under which "variables" are stored in the branch state table, to distinguish
031     * them from non-variable key/value pairs.
032     */
033    public static final String VARIABLE_PREFIX = "var::";
034
035    private static final long serialVersionUID = -7642477013444817952L;
036
037    @ManyToOne(fetch=FetchType.EAGER)
038        @JoinColumn(name="RTE_BRCH_ID")
039        private Branch branch;
040    @Version
041        @Column(name="VER_NBR")
042        private Integer lockVerNbr;
043    
044    public BranchState() {}
045    
046    public BranchState(String key, String value) {
047        super(key, value);
048    }
049    
050    public Branch getBranch() {
051        return branch;
052    }
053
054    public void setBranch(Branch branch) {
055        this.branch = branch;
056    }
057
058    public String getBranchStateId() {
059        return getStateId();
060    }
061
062    public void setBranchStateId(String branchStateId) {
063        setStateId(branchStateId);
064    }
065
066    public Integer getLockVerNbr() {
067        return lockVerNbr;
068    }
069
070    public void setLockVerNbr(Integer lockVerNbr) {
071        this.lockVerNbr = lockVerNbr;
072    }
073}
074