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.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.common.entity.AttributeOwner;
34  import org.kuali.student.common.entity.MetaEntity;
35  
36  @Entity
37  @Table(name = "KSLU_LUILUI_RELTN")
38  @NamedQueries( {
39  	@NamedQuery(name = "LuiLuiRelation.getLuiLuiRelationsByLuiId", query = "SELECT llr FROM LuiLuiRelation llr WHERE llr.lui.id = :luiId"),
40  	@NamedQuery(name = "LuiLuiRelation.getLuiIdsByRelationType", query = "SELECT rel.lui.id FROM LuiLuiRelation rel WHERE rel.relatedLui.id = :luiId AND rel.luLuRelationType.id = :luLuRelationTypeId"),
41  	@NamedQuery(name = "LuiLuiRelation.getLuisByRelationType", query = "SELECT rel.lui FROM LuiLuiRelation rel WHERE rel.relatedLui.id = :luiId AND rel.luLuRelationType.id = :luLuRelationTypeId"),
42  	@NamedQuery(name = "LuiLuiRelation.getRelatedLuiIdsByLuiId", query = "SELECT rel.relatedLui.id FROM LuiLuiRelation rel WHERE rel.lui.id = :luiId AND rel.luLuRelationType.id = :luLuRelationTypeId"),
43  	@NamedQuery(name = "LuiLuiRelation.getRelationTypeByLuiId", query = "SELECT distinct rel.luLuRelationType.id FROM LuiLuiRelation rel WHERE rel.lui.id = :luiId AND rel.relatedLui.id = :relatedLuiId"),
44  	@NamedQuery(name = "LuiLuiRelation.getRelatedLuisByLuiId", query = "SELECT rel.relatedLui FROM LuiLuiRelation rel WHERE rel.lui.id = :luiId AND rel.luLuRelationType.id = :luLuRelationTypeId")
45  })
46  public class LuiLuiRelation extends MetaEntity implements
47  		AttributeOwner<LuiLuiRelationAttribute> {
48  
49  	@ManyToOne
50  	@JoinColumn(name = "LUI_ID")
51  	private Lui lui;
52  
53  	@ManyToOne
54  	@JoinColumn(name = "RELATED_LUI_ID")
55  	private Lui relatedLui;
56  
57  	@ManyToOne
58  	@JoinColumn(name = "LULU_RELTN_TYPE_ID")
59  	private LuLuRelationType luLuRelationType;
60  
61  	@Temporal(TemporalType.TIMESTAMP)
62  	@Column(name = "EFF_DT")
63  	private Date effectiveDate;
64  
65  	@Temporal(TemporalType.TIMESTAMP)
66  	@Column(name = "EXPIR_DT")
67  	private Date expirationDate;
68  
69  	@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
70  	private List<LuiLuiRelationAttribute> attributes;
71  
72  	@Column(name = "ST")
73  	private String state;
74  
75  	public Lui getLui() {
76  		return lui;
77  	}
78  
79  	public void setLui(Lui lui) {
80  		this.lui = lui;
81  	}
82  
83  	public Lui getRelatedLui() {
84  		return relatedLui;
85  	}
86  
87  	public void setRelatedLui(Lui relatedLui) {
88  		this.relatedLui = relatedLui;
89  	}
90  
91  	public LuLuRelationType getLuLuRelationType() {
92  		return luLuRelationType;
93  	}
94  
95  	public void setLuLuRelationType(LuLuRelationType luLuRelationType) {
96  		this.luLuRelationType = luLuRelationType;
97  	}
98  
99  	public Date getEffectiveDate() {
100 		return effectiveDate;
101 	}
102 
103 	public void setEffectiveDate(Date effectiveDate) {
104 		this.effectiveDate = effectiveDate;
105 	}
106 
107 	public Date getExpirationDate() {
108 		return expirationDate;
109 	}
110 
111 	public void setExpirationDate(Date expirationDate) {
112 		this.expirationDate = expirationDate;
113 	}
114 
115 	public List<LuiLuiRelationAttribute> getAttributes() {
116 		return attributes;
117 	}
118 
119 	public void setAttributes(List<LuiLuiRelationAttribute> attributes) {
120 		this.attributes = attributes;
121 	}
122 
123 	public String getState() {
124 		return state;
125 	}
126 
127 	public void setState(String state) {
128 		this.state = state;
129 	}
130 }