1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.common.ui.server.applicationstate.entity; |
17 | |
|
18 | |
import java.util.List; |
19 | |
|
20 | |
import javax.persistence.CascadeType; |
21 | |
import javax.persistence.Column; |
22 | |
import javax.persistence.Entity; |
23 | |
import javax.persistence.Id; |
24 | |
import javax.persistence.JoinTable; |
25 | |
import javax.persistence.NamedQueries; |
26 | |
import javax.persistence.NamedQuery; |
27 | |
import javax.persistence.OneToMany; |
28 | |
import javax.persistence.PrePersist; |
29 | |
import javax.persistence.Table; |
30 | |
import javax.persistence.UniqueConstraint; |
31 | |
|
32 | |
import org.kuali.student.common.util.UUIDHelper; |
33 | |
|
34 | |
@Entity |
35 | |
@Table(name = "KSAP_APP_STATE_T", |
36 | |
uniqueConstraints={@UniqueConstraint(columnNames={"APPLICATION_ID", "REFERENCE_KEY", "REFERENCE_TYPE", "USER_ID"})}) |
37 | |
@NamedQueries( { |
38 | |
@NamedQuery(name = "ApplicationState.getApplicationStateByAppRefUserId", query = "SELECT appState FROM ApplicationState appState WHERE appState.applicationId =:applicationId AND appState.referenceKey =:referenceKey AND appState.referenceType =:referenceType AND appState.userId =:userId") |
39 | |
} ) |
40 | 10 | public class ApplicationState { |
41 | |
|
42 | |
@Id |
43 | |
@Column(name = "ID") |
44 | |
private String id; |
45 | |
|
46 | |
@Column(name = "APPLICATION_ID", nullable=false) |
47 | |
private String applicationId; |
48 | |
|
49 | |
@Column(name = "REFERENCE_KEY", nullable=false) |
50 | |
private String referenceKey; |
51 | |
|
52 | |
@Column(name = "REFERENCE_TYPE", nullable=false) |
53 | |
private String referenceType; |
54 | |
|
55 | |
@Column(name = "USER_ID", nullable=false) |
56 | |
private String userId; |
57 | |
|
58 | |
@OneToMany(cascade = CascadeType.ALL) |
59 | |
@JoinTable(name="KS_APP_ST_JN_KEY_VALUE") |
60 | |
private List<KeyValuePair> keyValueList; |
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
@PrePersist |
66 | |
public void prePersist() { |
67 | 10 | this.id = UUIDHelper.genStringUUID(this.id); |
68 | 10 | } |
69 | |
|
70 | |
public String getId() { |
71 | 6 | return id; |
72 | |
} |
73 | |
|
74 | |
public void setId(String id) { |
75 | 0 | this.id = id; |
76 | 0 | } |
77 | |
|
78 | |
public String getApplicationId() { |
79 | 12 | return applicationId; |
80 | |
} |
81 | |
|
82 | |
public void setApplicationId(String applicationId) { |
83 | 11 | this.applicationId = applicationId; |
84 | 11 | } |
85 | |
|
86 | |
public String getReferenceKey() { |
87 | 12 | return referenceKey; |
88 | |
} |
89 | |
|
90 | |
public void setReferenceKey(String referenceKey) { |
91 | 11 | this.referenceKey = referenceKey; |
92 | 11 | } |
93 | |
|
94 | |
public String getReferenceType() { |
95 | 12 | return referenceType; |
96 | |
} |
97 | |
|
98 | |
public void setReferenceType(String referenceType) { |
99 | 11 | this.referenceType = referenceType; |
100 | 11 | } |
101 | |
|
102 | |
public String getUserId() { |
103 | 24 | return userId; |
104 | |
} |
105 | |
|
106 | |
public void setUserId(String userId) { |
107 | 17 | this.userId = userId; |
108 | 17 | } |
109 | |
|
110 | |
public List<KeyValuePair> getKeyValueList() { |
111 | 13 | return keyValueList; |
112 | |
} |
113 | |
|
114 | |
public void setKeyValueList(List<KeyValuePair> keyValueList) { |
115 | 12 | this.keyValueList = keyValueList; |
116 | 12 | } |
117 | |
|
118 | |
@Override |
119 | |
public String toString() { |
120 | 8 | return "ApplicationState[id=" + id + ", applicationId=" + applicationId |
121 | |
+ ", referenceKey=" + referenceKey + ", referenceType=" |
122 | |
+ referenceType + ", userId=" + userId + "]"; |
123 | |
} |
124 | |
} |