1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kim.bo.ui;
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.GeneratedValue;
24 import javax.persistence.Id;
25 import javax.persistence.JoinColumn;
26 import javax.persistence.JoinColumns;
27 import javax.persistence.OneToMany;
28 import javax.persistence.Table;
29 import javax.persistence.Transient;
30
31 import org.eclipse.persistence.annotations.JoinFetch;
32 import org.eclipse.persistence.annotations.JoinFetchType;
33 import org.kuali.rice.kim.api.responsibility.Responsibility;
34 import org.kuali.rice.kim.api.services.KimApiServiceLocator;
35 import org.kuali.rice.kim.impl.responsibility.ResponsibilityBo;
36 import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
37 import org.springframework.util.AutoPopulatingList;
38
39
40
41
42 @Entity
43 @Table(name = "KRIM_PND_ROLE_RSP_T")
44 public class KimDocumentRoleResponsibility extends KimDocumentBoActivatableBase {
45
46 private static final long serialVersionUID = -4465768714850961538L;
47
48 @PortableSequenceGenerator(name = "KRIM_ROLE_RSP_ID_S")
49 @GeneratedValue(generator = "KRIM_ROLE_RSP_ID_S")
50 @Id
51 @Column(name = "ROLE_RSP_ID")
52 protected String roleResponsibilityId;
53
54 @Column(name = "ROLE_ID")
55 protected String roleId;
56
57 @Column(name = "RSP_ID")
58 protected String responsibilityId;
59
60
61
62
63
64 @Transient
65 protected ResponsibilityBo kimResponsibility;
66
67 @JoinFetch(value= JoinFetchType.OUTER)
68 @OneToMany(targetEntity = KimDocumentRoleResponsibilityAction.class, orphanRemoval = true, cascade = { CascadeType.REFRESH, CascadeType.REMOVE, CascadeType.PERSIST })
69 @JoinColumns({
70 @JoinColumn(name = "FDOC_NBR", referencedColumnName = "FDOC_NBR", insertable = false, updatable = false)
71 ,@JoinColumn(name = "ROLE_RSP_ID", referencedColumnName = "ROLE_RSP_ID", insertable = false, updatable = false)
72 })
73 protected List<KimDocumentRoleResponsibilityAction> roleRspActions = new AutoPopulatingList<KimDocumentRoleResponsibilityAction>(KimDocumentRoleResponsibilityAction.class);
74
75 @Transient
76 protected String name;
77
78 @Transient
79 protected String namespaceCode;
80
81 public String getRoleId() {
82 return roleId;
83 }
84
85 public void setRoleId(String roleId) {
86 this.roleId = roleId;
87 }
88
89 public void setRoleResponsibilityId(String roleResponsibilityId) {
90 this.roleResponsibilityId = roleResponsibilityId;
91 }
92
93
94
95
96 public String getRoleResponsibilityId() {
97 return this.roleResponsibilityId;
98 }
99
100
101
102
103 public ResponsibilityBo getKimResponsibility() {
104 if (kimResponsibility == null && responsibilityId != null) {
105
106
107
108 Responsibility info = KimApiServiceLocator.getResponsibilityService().getResponsibility(getResponsibilityId());
109 kimResponsibility = ResponsibilityBo.from(info);
110 }
111 return this.kimResponsibility;
112 }
113
114
115
116
117 public void setResponsibilityId(String responsibilityId) {
118 this.responsibilityId = responsibilityId;
119 }
120
121
122
123
124 public void setKimResponsibility(ResponsibilityBo kimResponsibility) {
125 this.kimResponsibility = kimResponsibility;
126 }
127
128
129
130
131 public String getResponsibilityId() {
132 return this.responsibilityId;
133 }
134
135
136
137
138 public KimDocumentRoleResponsibilityAction getRoleRspAction() {
139 if (this.roleRspActions != null && this.roleRspActions.size() > 0)
140 return this.roleRspActions.get(0);
141 return null;
142 }
143
144
145
146
147 public List<KimDocumentRoleResponsibilityAction> getRoleRspActions() {
148 return this.roleRspActions;
149 }
150
151
152
153
154 public void setRoleRspActions(List<KimDocumentRoleResponsibilityAction> roleRspActions) {
155 this.roleRspActions = roleRspActions;
156 }
157
158 public String getName() {
159 if (null == kimResponsibility) {
160 getKimResponsibility();
161 }
162 if (null == kimResponsibility) {
163 return "";
164 }
165 return kimResponsibility.getName();
166 }
167
168 public String getNamespaceCode() {
169 if (null == kimResponsibility) {
170 getKimResponsibility();
171 }
172 if (null == kimResponsibility) {
173 return "";
174 }
175 return kimResponsibility.getNamespaceCode();
176 }
177 }