1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.mobility.library.entity;
17
18 import javax.persistence.CascadeType;
19 import javax.persistence.Column;
20 import javax.persistence.Entity;
21 import javax.persistence.GeneratedValue;
22 import javax.persistence.GenerationType;
23 import javax.persistence.Id;
24 import javax.persistence.JoinColumn;
25 import javax.persistence.NamedQueries;
26 import javax.persistence.NamedQuery;
27 import javax.persistence.OneToOne;
28 import javax.persistence.Table;
29
30
31
32
33
34
35
36
37 @NamedQueries({
38
39 @NamedQuery(
40 name="Library.getLibraries",
41 query="SELECT a FROM Library a ORDER BY a.campusCode, a.order ASC "),
42
43 @NamedQuery(
44 name="Library.getLibrariesByIds",
45 query="SELECT a FROM Library a where a.id IN (:libraryIds) ORDER BY a.campusCode, a.order ASC "),
46
47 @NamedQuery(
48 name="Library.getCampusWithLibraries",
49 query="SELECT DISTINCT l.campusCode FROM Library l ORDER BY l.campusCode ASC "),
50
51 @NamedQuery(
52 name="Library.getLibariesForCampus",
53 query="SELECT l FROM Library l WHERE l.campusCode = :campusCode ORDER BY l.order ASC ")
54
55
56 })
57 @Entity
58 @Table(name="LIBRARY")
59 public class Library {
60
61
62 @Id
63 @GeneratedValue(strategy = GenerationType.TABLE)
64 @Column(name="ID")
65 private Long id;
66
67
68
69
70 @Column(name="NAME" , nullable=false)
71 private String name;
72
73
74
75
76 @Column(name="ORDR")
77 private int order;
78
79
80
81
82 @Column(name="CAMPUS_CODE")
83 private String campusCode;
84
85
86
87
88 @OneToOne(optional=false,cascade=CascadeType.ALL)
89 @JoinColumn(name="LIBRARY_CONTACT_ID")
90 private LibraryContactDetail libraryContactDetail;
91
92
93
94
95 @Column(name="ACTIVE")
96 private boolean active;
97
98
99
100
101
102 public Long getId() {
103 return id;
104 }
105
106
107
108
109
110 public void setId(Long id) {
111 this.id = id;
112 }
113
114
115
116
117
118 public String getName() {
119 return name;
120 }
121
122
123
124
125
126 public void setName(String name) {
127 this.name = name;
128 }
129
130
131
132
133
134 public int getOrder() {
135 return order;
136 }
137
138
139
140
141
142 public void setOrder(int order) {
143 this.order = order;
144 }
145
146
147
148
149
150 public String getCampusCode() {
151 return campusCode;
152 }
153
154
155
156
157
158 public void setCampusCode(String campusCode) {
159 this.campusCode = campusCode;
160 }
161
162
163
164
165
166 public LibraryContactDetail getLibraryContactDetail() {
167 return libraryContactDetail;
168 }
169
170
171
172
173
174 public void setLibraryContactDetail(LibraryContactDetail libraryContactDetail) {
175 this.libraryContactDetail = libraryContactDetail;
176 }
177
178
179
180
181
182 public boolean isActive() {
183 return active;
184 }
185
186
187
188
189
190 public void setActive(boolean active) {
191 this.active = active;
192 }
193
194
195
196
197 }