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 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | 0 | @Entity |
35 | |
@Table(name="KME_HM_TL_T") |
36 | |
public class HomeTool implements Serializable, Comparable<HomeTool> { |
37 | |
|
38 | |
private static final long serialVersionUID = -8942674782383943102L; |
39 | |
|
40 | |
@Id |
41 | |
@GeneratedValue(strategy = GenerationType.TABLE) |
42 | |
@Column(name="ID") |
43 | |
private Long homeToolId; |
44 | |
|
45 | |
@Column(name="HM_SCRN_ID", insertable=false, updatable=false) |
46 | |
private Long homeScreenId; |
47 | |
|
48 | |
@Column(name="TL_ID", insertable=false, updatable=false) |
49 | |
private Long toolId; |
50 | |
|
51 | |
@Column(name="ORDR") |
52 | |
private int order; |
53 | |
|
54 | |
@ManyToOne |
55 | |
@JoinColumn(name="HM_SCRN_ID") |
56 | |
private HomeScreen homeScreen; |
57 | |
|
58 | |
@ManyToOne(fetch = FetchType.EAGER) |
59 | |
@JoinColumn(name="TL_ID") |
60 | |
private Tool tool; |
61 | |
|
62 | |
@Version |
63 | |
@Column(name="VER_NBR") |
64 | |
private Long versionNumber; |
65 | |
|
66 | 0 | public HomeTool() {} |
67 | |
|
68 | 0 | public HomeTool(HomeScreen homeScreen, Tool tool, int order) { |
69 | 0 | this.homeScreen = homeScreen; |
70 | 0 | this.homeScreenId = homeScreen.getHomeScreenId(); |
71 | 0 | this.tool = tool; |
72 | 0 | this.toolId = tool.getToolId(); |
73 | 0 | this.order = order; |
74 | 0 | } |
75 | |
|
76 | |
public Long getHomeScreenId() { |
77 | 0 | return homeScreenId; |
78 | |
} |
79 | |
|
80 | |
public void setHomeScreenId(Long homeScreenId) { |
81 | 0 | this.homeScreenId = homeScreenId; |
82 | 0 | } |
83 | |
|
84 | |
public Long getToolId() { |
85 | 0 | return toolId; |
86 | |
} |
87 | |
|
88 | |
public void setToolId(Long toolId) { |
89 | 0 | this.toolId = toolId; |
90 | 0 | } |
91 | |
|
92 | |
|
93 | |
|
94 | |
|
95 | |
public int getOrder() { |
96 | 0 | return order; |
97 | |
} |
98 | |
|
99 | |
|
100 | |
|
101 | |
|
102 | |
|
103 | |
public void setOrder(int order) { |
104 | 0 | this.order = order; |
105 | 0 | } |
106 | |
|
107 | |
public Long getVersionNumber() { |
108 | 0 | return versionNumber; |
109 | |
} |
110 | |
|
111 | |
public void setVersionNumber(Long versionNumber) { |
112 | 0 | this.versionNumber = versionNumber; |
113 | 0 | } |
114 | |
|
115 | |
public Long getHomeToolId() { |
116 | 0 | return homeToolId; |
117 | |
} |
118 | |
|
119 | |
public void setHomeToolId(Long homeToolId) { |
120 | 0 | this.homeToolId = homeToolId; |
121 | 0 | } |
122 | |
|
123 | |
|
124 | |
|
125 | |
|
126 | |
public HomeScreen getHomeScreen() { |
127 | 0 | return homeScreen; |
128 | |
} |
129 | |
|
130 | |
|
131 | |
|
132 | |
|
133 | |
|
134 | |
public void setHomeScreen(HomeScreen homeScreen) { |
135 | 0 | this.homeScreen = homeScreen; |
136 | 0 | } |
137 | |
|
138 | |
|
139 | |
|
140 | |
|
141 | |
public Tool getTool() { |
142 | 0 | return tool; |
143 | |
} |
144 | |
|
145 | |
|
146 | |
|
147 | |
|
148 | |
|
149 | |
public void setTool(Tool tool) { |
150 | 0 | this.tool = tool; |
151 | 0 | } |
152 | |
|
153 | |
@Override |
154 | |
public int compareTo(HomeTool that) { |
155 | 0 | if (that == null) { |
156 | 0 | return -1; |
157 | |
} |
158 | 0 | if (this.order == that.order) { |
159 | 0 | return 0; |
160 | |
} |
161 | 0 | return this.order < that.order ? -1 : 1; |
162 | |
} |
163 | |
|
164 | |
} |