View Javadoc

1   /*
2    * Copyright 2007-2010 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.documentlink;
17  
18  import javax.persistence.Column;
19  import javax.persistence.Entity;
20  import javax.persistence.Id;
21  import javax.persistence.PrePersist;
22  import javax.persistence.Table;
23  
24  import org.kuali.rice.core.jpa.annotations.Sequence;
25  import org.kuali.rice.core.util.OrmUtils;
26  import org.kuali.rice.kew.bo.WorkflowPersistable;
27  import org.kuali.rice.kew.service.KEWServiceLocator;
28  
29  /**
30   * Server side bean for DocumentLinkDAO 
31   * 
32   * @author Kuali Rice Team (kuali-rice@googlegroups.com)
33   *
34   */
35  
36  @Entity
37  @Table(name="KREW_DOC_LNK_T")
38  @Sequence(name="KREW_DOC_LNK_S",property="docLinkId")
39  public class DocumentLink implements WorkflowPersistable {
40  
41  	private static final long serialVersionUID = 551926904795633010L;
42  	
43  	@Id
44  	@Column(name="DOC_LNK_ID")
45  	private Long docLinkId;
46      @Column(name="ORGN_DOC_ID")
47  	private Long orgnDocId;
48      @Column(name="DEST_DOC_ID")
49  	private Long destDocId;
50      
51  	/**
52  	 * @return the docLinkId
53  	 */
54  	public Long getDocLinkId() {
55  		return this.docLinkId;
56  	}
57  
58  	/**
59  	 * @param docLinkId the docLinkId to set
60  	 */
61  	public void setDocLinkId(Long docLinkId) {
62  		this.docLinkId = docLinkId;
63  	}
64  
65  	/**
66  	 * @return the orgnDocId
67  	 */
68  	public Long getOrgnDocId() {
69  		return this.orgnDocId;
70  	}
71  
72  	/**
73  	 * @param orgnDocId the orgnDocId to set
74  	 */
75  	public void setOrgnDocId(Long orgnDocId) {
76  		this.orgnDocId = orgnDocId;
77  	}
78  
79  	/**
80  	 * @return the destDocId
81  	 */
82  	public Long getDestDocId() {
83  		return this.destDocId;
84  	}
85  
86  	/**
87  	 * @param destDocId the destDocId to set
88  	 */
89  	public void setDestDocId(Long destDocId) {
90  		this.destDocId = destDocId;
91  	}
92  
93  	/**
94  	 * This overridden method ...
95  	 * 
96  	 * @see org.kuali.rice.kew.bo.WorkflowPersistable#copy(boolean)
97  	 */
98  	public Object copy(boolean preserveKeys) {
99  		return null;
100 	}
101 	
102 	@PrePersist
103 	public void beforeInsert(){
104 		OrmUtils.populateAutoIncValue(this, KEWServiceLocator.getEntityManagerFactory().createEntityManager());		
105 	}
106 
107 }