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.proposal.entity;
17  
18  import java.util.List;
19  
20  import javax.persistence.AttributeOverride;
21  import javax.persistence.Column;
22  import javax.persistence.Entity;
23  import javax.persistence.FetchType;
24  import javax.persistence.JoinColumn;
25  import javax.persistence.ManyToMany;
26  import javax.persistence.ManyToOne;
27  import javax.persistence.NamedQueries;
28  import javax.persistence.NamedQuery;
29  import javax.persistence.Table;
30  
31  import org.kuali.student.common.entity.BaseEntity;
32  
33  /**
34   * Join table between Proposal and what it references
35   *
36   * @author Kuali Rice Team (kuali-rice@googlegroups.com)
37   *
38   */
39  @Entity
40  @Table(name = "KSPR_PROPOSAL_REFERENCE")
41  @NamedQueries( {
42      @NamedQuery(name = "ProposalReference.getObjectReference", query = "SELECT o FROM ProposalReference o WHERE o.objectReferenceId = :objectReferenceId AND o.type.id = :objectReferenceType")
43  })
44  @AttributeOverride(name="id", column=@Column(name="REFERENCE_ID"))
45  public class ProposalReference extends BaseEntity{
46  
47      @ManyToMany(mappedBy="proposalReference",fetch=FetchType.EAGER)
48      private List<Proposal> proposals;
49  
50      @Column(name = "OBJECT_REFERENCE_ID")
51      private String objectReferenceId;
52  
53      @ManyToOne(optional=true)
54      @JoinColumn(name = "TYPE")
55      private ProposalReferenceType type;
56  
57      public List<Proposal> getProposals() {
58          return proposals;
59      }
60  
61      public void setProposals(List<Proposal> proposals) {
62          this.proposals = proposals;
63      }
64  
65      public String getObjectReferenceId() {
66          return objectReferenceId;
67      }
68  
69      public void setObjectReferenceId(String objectReferenceId) {
70          this.objectReferenceId = objectReferenceId;
71      }
72  
73      public ProposalReferenceType getType() {
74          return type;
75      }
76  
77      public void setType(ProposalReferenceType type) {
78          this.type = type;
79      }
80  }