1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.kuali.mobility.admin.entity;
16
17 import java.io.Serializable;
18
19 import javax.persistence.Column;
20 import javax.persistence.Entity;
21 import javax.persistence.FetchType;
22 import javax.persistence.GeneratedValue;
23 import javax.persistence.GenerationType;
24 import javax.persistence.Id;
25 import javax.persistence.JoinColumn;
26 import javax.persistence.ManyToOne;
27 import javax.persistence.Table;
28 import javax.persistence.Version;
29 import javax.xml.bind.annotation.XmlRootElement;
30 import javax.xml.bind.annotation.XmlTransient;
31
32
33
34
35
36
37 @Entity
38 @Table(name="KME_HM_TL_T")
39 @XmlRootElement(name="homeTool")
40 public class HomeTool implements Serializable, Comparable<HomeTool> {
41
42 private static final long serialVersionUID = -8942674782383943102L;
43
44
45
46
47 @Id
48 @GeneratedValue(strategy = GenerationType.TABLE)
49 @Column(name="ID")
50 private Long homeToolId;
51
52
53
54
55 @Column(name="HM_SCRN_ID", insertable=false, updatable=false)
56 private Long homeScreenId;
57
58
59
60
61 @Column(name="TL_ID", insertable=false, updatable=false)
62 private Long toolId;
63
64
65
66
67 @Column(name="ORDR")
68 private int order;
69
70
71
72
73 @ManyToOne
74 @JoinColumn(name="HM_SCRN_ID")
75 private HomeScreen homeScreen;
76
77
78
79
80 @ManyToOne(fetch = FetchType.EAGER)
81 @JoinColumn(name="TL_ID")
82 private Tool tool;
83
84
85
86
87 @Version
88 @Column(name="VER_NBR")
89 private Long versionNumber;
90
91
92
93
94 public HomeTool() {}
95
96
97
98
99
100
101
102 public HomeTool(HomeScreen homeScreen, Tool tool, int order) {
103 this.homeScreen = homeScreen;
104 this.homeScreenId = homeScreen.getHomeScreenId();
105 this.tool = tool;
106 this.toolId = tool.getToolId();
107 this.order = order;
108 }
109
110
111
112
113
114
115
116 public Long getHomeToolId() {
117 return homeToolId;
118 }
119
120
121
122
123
124 public void setHomeToolId(Long homeToolId) {
125 this.homeToolId = homeToolId;
126 }
127
128
129
130
131
132 public Long getHomeScreenId() {
133 return homeScreenId;
134 }
135
136
137
138
139
140 public void setHomeScreenId(Long homeScreenId) {
141 this.homeScreenId = homeScreenId;
142 }
143
144
145
146
147
148 public Long getToolId() {
149 return toolId;
150 }
151
152
153
154
155
156 public void setToolId(Long toolId) {
157 this.toolId = toolId;
158 }
159
160
161
162
163
164 public int getOrder() {
165 return order;
166 }
167
168
169
170
171
172 public void setOrder(int order) {
173 this.order = order;
174 }
175
176
177
178
179
180 public Long getVersionNumber() {
181 return versionNumber;
182 }
183
184
185
186
187
188 public void setVersionNumber(Long versionNumber) {
189 this.versionNumber = versionNumber;
190 }
191
192
193
194
195
196 @XmlTransient
197 public HomeScreen getHomeScreen() {
198 return homeScreen;
199 }
200
201
202
203
204
205 public void setHomeScreen(HomeScreen homeScreen) {
206 this.homeScreen = homeScreen;
207 }
208
209
210
211
212
213 public Tool getTool() {
214 return tool;
215 }
216
217
218
219
220
221 public void setTool(Tool tool) {
222 this.tool = tool;
223 }
224
225
226
227
228
229 @Override
230 public int compareTo(HomeTool that) {
231 if (that == null) {
232 return -1;
233 }
234 if (this.order == that.order) {
235 return 0;
236 }
237 return this.order < that.order ? -1 : 1;
238 }
239
240 }