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 java.io.Serializable; 019 020import javax.persistence.Column; 021import javax.persistence.Entity; 022import javax.persistence.GeneratedValue; 023import javax.persistence.Id; 024import javax.persistence.Table; 025import javax.persistence.Version; 026 027import org.hibernate.annotations.GenericGenerator; 028import org.hibernate.annotations.Parameter; 029import org.kuali.rice.core.framework.persistence.jpa.OrmUtils; 030import org.kuali.rice.kew.service.KEWServiceLocator; 031 032/** 033 * Represents a Branch in the definition of a DocumentType. This should not be confused with the 034 * {@link Branch} class which represents the actual instance of a branch on a document. 035 * 036 * @author Kuali Rice Team (rice.collab@kuali.org) 037 */ 038@Entity 039@Table(name="KREW_RTE_BRCH_PROTO_T") 040//@Sequence(name="KREW_RTE_NODE_S", property="branchId") 041public class BranchPrototype implements Serializable { 042 043 private static final long serialVersionUID = 8645994738204838275L; 044 045 @Id 046 @GeneratedValue(generator="KREW_RTE_NODE_S") 047 @GenericGenerator(name="KREW_RTE_NODE_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={ 048 @Parameter(name="sequence_name",value="KREW_RTE_NODE_S"), 049 @Parameter(name="value_column",value="id") 050 }) 051 @Column(name="RTE_BRCH_PROTO_ID") 052 private String branchId; 053 @Column(name="BRCH_NM") 054 private String name; 055 @Version 056 @Column(name="VER_NBR") 057 private Integer lockVerNbr; 058 059 public String getBranchId() { 060 return branchId; 061 } 062 063 public void setBranchId(String branchId) { 064 this.branchId = branchId; 065 } 066 067 public String getName() { 068 return name; 069 } 070 071 public void setName(String name) { 072 this.name = name; 073 } 074 075 public Integer getLockVerNbr() { 076 return lockVerNbr; 077 } 078 079 public void setLockVerNbr(Integer lockVerNbr) { 080 this.lockVerNbr = lockVerNbr; 081 } 082 083 //@PrePersist 084 public void beforeInsert(){ 085 OrmUtils.populateAutoIncValue(this, KEWServiceLocator.getEntityManagerFactory().createEntityManager()); 086 } 087 088} 089