1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.r2.lum.lo.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.FetchType;
25 import javax.persistence.JoinColumn;
26 import javax.persistence.JoinTable;
27 import javax.persistence.ManyToOne;
28 import javax.persistence.NamedQueries;
29 import javax.persistence.NamedQuery;
30 import javax.persistence.OneToMany;
31 import javax.persistence.Table;
32 import javax.persistence.Temporal;
33 import javax.persistence.TemporalType;
34
35 import org.kuali.student.r1.common.entity.AttributeOwner;
36 import org.kuali.student.r1.common.entity.MetaEntity;
37
38
39
40
41 @Entity
42 @Table(name = "KSLO_LO")
43 @NamedQueries( {
44 @NamedQuery(name = "Lo.getAllowedLoLoRelationTypes", query = "SELECT relType.relationTypeId FROM AllowedLoLoRelationType relType WHERE relType.loTypeId = :loTypeKey AND relType.relatedLoTypeId = :relatedLoTypeKey"),
45 @NamedQuery(name = "Lo.getRelatedLosByLoId", query = "SELECT rel.relatedLo FROM LoLoRelation rel WHERE rel.lo.id = :loId AND rel.loLoRelationType.id = :loLoRelationTypeId"),
46 @NamedQuery(name = "Lo.getLosByRelatedLoId", query = "SELECT rel.lo FROM LoLoRelation rel WHERE rel.relatedLo.id = :relatedLoId AND rel.loLoRelationType.id = :loLoRelationTypeId"),
47 @NamedQuery(name = "Lo.getLoCategories", query = "SELECT c FROM LoCategory c WHERE c.loRepository.id = :repositoryId"),
48 @NamedQuery(name = "Lo.findLosByIdList", query = "SELECT l FROM Lo l WHERE l.id IN (:idList)"),
49 @NamedQuery(name = "Lo.getLoCategoriesForLo", query = "SELECT j.loCategory FROM LoLoCategoryJoin j WHERE j.lo.id = :loId"),
50 @NamedQuery(name = "Lo.getLosByLoCategory", query = "SELECT j.lo FROM LoLoCategoryJoin j WHERE j.loCategory.id = :loCategoryId"),
51 @NamedQuery(name = "Lo.getLosByRepository", query = "SELECT l FROM Lo l WHERE l.loRepository.id = :loRepositoryId"),
52 @NamedQuery(name = "Lo.getLoLoRelationsByLoId", query = "SELECT llRel FROM LoLoRelation llRel WHERE llRel.lo.id = :loId OR llRel.relatedLo.id = :loId"),
53 @NamedQuery(name = "Lo.getLoCategoryJoin", query = "SELECT j FROM LoLoCategoryJoin j WHERE j.lo.id = :loId AND j.loCategory.id = :loCategoryId")
54 })
55 public class Lo extends MetaEntity implements AttributeOwner<LoAttribute> {
56
57 @Column(name = "NAME")
58 private
59 String name;
60
61 @ManyToOne(cascade = CascadeType.ALL)
62 @JoinColumn(name = "RT_DESCR_ID")
63 private LoRichText descr;
64
65 @ManyToOne
66 @JoinColumn(name = "LO_REPO_ID")
67 private LoRepository loRepository;
68
69 @Temporal(TemporalType.TIMESTAMP)
70 @Column(name = "EFF_DT")
71 private Date effectiveDate;
72
73 @Temporal(TemporalType.TIMESTAMP)
74 @Column(name = "EXPIR_DT")
75 private Date expirationDate;
76
77 @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
78 private List<LoAttribute> attributes;
79
80 @OneToMany(fetch=FetchType.LAZY, mappedBy="lo")
81 private List<LoLoCategoryJoin> categories;
82
83 @ManyToOne
84 @JoinColumn(name = "LOTYPE_ID")
85 private LoType loType;
86
87 @Column(name = "ST")
88 private String state;
89
90
91
92
93 public void setName(String name) {
94 this.name = name;
95 }
96
97
98
99
100 public String getName() {
101 return name;
102 }
103
104 public LoRichText getDescr() {
105 return descr;
106 }
107
108 public void setDescr(LoRichText descr) {
109 this.descr = descr;
110 }
111
112
113
114
115 public void setLoRepository(LoRepository loRepository) {
116 this.loRepository = loRepository;
117 }
118
119
120
121
122 public LoRepository getLoRepository() {
123 return loRepository;
124 }
125
126 public Date getEffectiveDate() {
127 return effectiveDate;
128 }
129
130 public void setEffectiveDate(Date effectiveDate) {
131 this.effectiveDate = effectiveDate;
132 }
133
134 public Date getExpirationDate() {
135 return expirationDate;
136 }
137
138 public void setExpirationDate(Date expirationDate) {
139 this.expirationDate = expirationDate;
140 }
141
142
143
144
145 @Override
146 public List<LoAttribute> getAttributes() {
147 return attributes;
148 }
149
150
151
152
153 @Override
154 public void setAttributes(List<LoAttribute> attributes) {
155 this.attributes = attributes;
156 }
157
158
159
160
161 public void setLoType(LoType loType) {
162 this.loType = loType;
163 }
164
165
166
167
168 public LoType getLoType() {
169 return loType;
170 }
171
172
173
174
175 public void setState(String state) {
176 this.state = state;
177 }
178
179
180
181
182 public String getState() {
183 return state;
184 }
185
186 public void setCategories(List<LoLoCategoryJoin> categories) {
187 this.categories = categories;
188 }
189
190 public List<LoLoCategoryJoin> getCategories() {
191 return categories;
192 }
193 }