View Javadoc

1   /**
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  
16  package org.kuali.student.core.comment.entity;
17  
18  import java.util.List;
19  
20  import javax.persistence.CascadeType;
21  import javax.persistence.Column;
22  import javax.persistence.Entity;
23  import javax.persistence.JoinColumn;
24  import javax.persistence.ManyToOne;
25  import javax.persistence.NamedQueries;
26  import javax.persistence.NamedQuery;
27  import javax.persistence.OneToMany;
28  import javax.persistence.Table;
29  import javax.persistence.UniqueConstraint;
30  
31  import org.kuali.student.common.entity.BaseEntity;
32  
33  @Entity
34  @Table(name = "KSCO_REFERENCE",
35          uniqueConstraints= @UniqueConstraint(columnNames={"REFERENCE_ID", "REFERENCE_TYPE"}))
36  @NamedQueries( {
37          @NamedQuery(name = "Reference.getReference", query = "SELECT reference FROM Reference reference WHERE reference.referenceId =:refId AND reference.referenceType.id=:refTypeId")})
38  public class Reference extends BaseEntity {
39      @Column(name="REFERENCE_ID")
40      private String referenceId;
41  
42      @ManyToOne
43      @JoinColumn(name = "REFERENCE_TYPE")
44      private ReferenceType referenceType;
45  
46      @OneToMany(cascade = CascadeType.ALL, mappedBy="reference")
47      private List<Tag> tags;
48  
49      @OneToMany(cascade = CascadeType.ALL, mappedBy="reference")
50      private List<Comment> comments;
51  
52      public String getReferenceId(){
53          return referenceId;
54      }
55  
56      public void setReferenceId(String referenceId){
57          this.referenceId=referenceId;
58      }
59  
60      public ReferenceType getReferenceType(){
61          return referenceType;
62      }
63  
64      public void setReferenceType(ReferenceType referenceType){
65          this.referenceType=referenceType;
66      }
67  
68      public List<Tag> getTags(){
69          return tags;
70      }
71  
72      public void setTags(List<Tag> tags){
73          this.tags=tags;
74      }
75  
76      public List<Comment> getCommentss(){
77          return comments;
78      }
79  
80      public void setComments(List<Comment> comments){
81          this.comments=comments;
82      }
83  }