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.r2.lum.lu.entity;
17  
18  import java.util.Date;
19  import java.util.List;
20  
21  import javax.persistence.CascadeType;
22  import javax.persistence.Column;
23  import javax.persistence.Entity;
24  import javax.persistence.JoinColumn;
25  import javax.persistence.ManyToOne;
26  import javax.persistence.NamedQueries;
27  import javax.persistence.NamedQuery;
28  import javax.persistence.OneToMany;
29  import javax.persistence.Table;
30  import javax.persistence.Temporal;
31  import javax.persistence.TemporalType;
32  
33  import org.kuali.student.r1.common.entity.AttributeOwner;
34  import org.kuali.student.r1.common.entity.MetaEntity;
35  
36  @Entity
37  @Table(name = "KSLU_CLU_LO_RELTN")
38  @NamedQueries({
39  	@NamedQuery(name="CluLoRelation.getCluLoRelation", query="SELECT rel FROM CluLoRelation rel WHERE rel.clu.id = :cluId and rel.loId = :loId"),
40  	@NamedQuery(name="CluLoRelation.getCluLoRelationByClu", query="SELECT rel FROM CluLoRelation rel WHERE rel.clu.id = :cluId"),
41  	@NamedQuery(name="CluLoRelation.getCluLoRelationByLo", query="SELECT rel FROM CluLoRelation rel WHERE rel.loId = :loId"),
42  	@NamedQuery(name="CluLoRelation.getCluLoRelationByCluIdAndType", query="SELECT rel.id FROM CluLoRelation rel WHERE rel.clu.id = :cluId AND rel.type.id = :cluLoRelationType")
43  })
44  public class CluLoRelation extends MetaEntity implements
45  AttributeOwner<CluLoRelationAttribute> {
46  
47  	@ManyToOne
48  	@JoinColumn(name="CLU_ID")
49      private Clu clu;
50  
51  	@Column(name="LO_ID")
52      private String loId; 
53  
54  	@Temporal(TemporalType.TIMESTAMP)
55  	@Column(name = "EFF_DT")
56      private Date effectiveDate;
57  
58  	@Temporal(TemporalType.TIMESTAMP)
59  	@Column(name = "EXPIR_DT")
60      private Date expirationDate;
61  
62  	@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
63      private List<CluLoRelationAttribute> attributes;
64  
65      @ManyToOne
66      @JoinColumn(name = "TYPE")
67  	private CluLoRelationType type;
68  
69  	@Column(name = "ST")
70      private String state;
71  	
72  	@Override
73  	public List<CluLoRelationAttribute> getAttributes() {
74  		return attributes;
75  	}
76  
77  	@Override
78  	public void setAttributes(List<CluLoRelationAttribute> attributes) {
79  		this.attributes = attributes;
80  	}
81  
82  	public Clu getClu() {
83  		return clu;
84  	}
85  
86  	public void setClu(Clu clu) {
87  		this.clu = clu;
88  	}
89  	
90  	public String getLoId() {
91  		return loId;
92  	}
93  
94  	public void setLoId(String loId) {
95  		this.loId = loId;
96  	}
97  
98  	public Date getEffectiveDate() {
99  		return effectiveDate;
100 	}
101 
102 	public void setEffectiveDate(Date effectiveDate) {
103 		this.effectiveDate = effectiveDate;
104 	}
105 
106 	public Date getExpirationDate() {
107 		return expirationDate;
108 	}
109 
110 	public void setExpirationDate(Date expirationDate) {
111 		this.expirationDate = expirationDate;
112 	}
113 
114 	public CluLoRelationType getType() {
115 		return type;
116 	}
117 
118 	public void setType(CluLoRelationType type) {
119 		this.type = type;
120 	}
121 
122 	public String getState() {
123 		return state;
124 	}
125 
126 	public void setState(String state) {
127 		this.state = state;
128 	}
129 }