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 org.hibernate.annotations.GenericGenerator;
19 import org.hibernate.annotations.Parameter;
20 import org.kuali.rice.kim.api.responsibility.Responsibility;
21 import org.kuali.rice.kim.api.services.KimApiServiceLocator;
22 import org.kuali.rice.kim.impl.responsibility.ResponsibilityBo;
23 import org.springframework.util.AutoPopulatingList;
24
25 import javax.persistence.Column;
26 import javax.persistence.Entity;
27 import javax.persistence.GeneratedValue;
28 import javax.persistence.Id;
29 import javax.persistence.IdClass;
30 import javax.persistence.Table;
31 import javax.persistence.Transient;
32 import java.util.List;
33
34
35
36
37 @IdClass(KimDocumentRoleResponsibilityId.class)
38 @Entity
39 @Table(name="KRIM_PND_ROLE_RSP_T")
40 public class KimDocumentRoleResponsibility extends KimDocumentBoActivatableBase {
41
42 private static final long serialVersionUID = -4465768714850961538L;
43 @Id
44 @GeneratedValue(generator="KRIM_ROLE_RSP_ACTN_ID_S")
45 @GenericGenerator(name="KRIM_ROLE_RSP_ACTN_ID_S",strategy="org.kuali.rice.core.jpa.spring.RiceNumericStringSequenceStyleGenerator",parameters={
46 @Parameter(name="sequence_name",value="KRIM_ROLE_RSP_ACTN_ID_S"),
47 @Parameter(name="value_column",value="id")
48 })
49 @Column(name="ROLE_RSP_ID")
50 protected String roleResponsibilityId;
51 @Column(name="ROLE_ID")
52 protected String roleId;
53 @Column(name="RSP_ID")
54 protected String responsibilityId;
55 @Transient
56 protected ResponsibilityBo kimResponsibility;
57 @Transient
58 protected List<KimDocumentRoleResponsibilityAction> roleRspActions = new AutoPopulatingList(KimDocumentRoleResponsibilityAction.class);
59 @Transient
60 protected String name;
61 @Transient
62 protected String namespaceCode;
63
64 public String getRoleId() {
65 return roleId;
66 }
67
68 public void setRoleId(String roleId) {
69 this.roleId = roleId;
70 }
71
72 public void setRoleResponsibilityId(String roleResponsibilityId) {
73 this.roleResponsibilityId = roleResponsibilityId;
74 }
75
76
77
78
79 public String getRoleResponsibilityId() {
80 return this.roleResponsibilityId;
81 }
82
83
84
85
86 public ResponsibilityBo getKimResponsibility() {
87 if ( kimResponsibility == null && responsibilityId != null ) {
88
89
90
91 Responsibility info = KimApiServiceLocator.getResponsibilityService().getResponsibility(getResponsibilityId());
92 kimResponsibility = ResponsibilityBo.from(info);
93 }
94 return this.kimResponsibility;
95 }
96
97
98
99
100 public void setResponsibilityId(String responsibilityId) {
101 this.responsibilityId = responsibilityId;
102 }
103
104
105
106
107 public void setKimResponsibility(ResponsibilityBo kimResponsibility) {
108 this.kimResponsibility = kimResponsibility;
109 }
110
111
112
113
114 public String getResponsibilityId() {
115 return this.responsibilityId;
116 }
117
118
119
120
121 public KimDocumentRoleResponsibilityAction getRoleRspAction() {
122 if(this.roleRspActions!=null && this.roleRspActions.size()>0)
123 return this.roleRspActions.get(0);
124 return null;
125 }
126
127
128
129
130 public List<KimDocumentRoleResponsibilityAction> getRoleRspActions() {
131 return this.roleRspActions;
132 }
133
134
135
136
137 public void setRoleRspActions(
138 List<KimDocumentRoleResponsibilityAction> roleRspActions) {
139 this.roleRspActions = roleRspActions;
140 }
141
142 public String getName(){
143 if( null == kimResponsibility ) {
144 getKimResponsibility();
145 }
146
147 if (null == kimResponsibility) {
148 return "";
149 }
150
151 return kimResponsibility.getName();
152 }
153
154 public String getNamespaceCode(){
155 if( null == kimResponsibility ) {
156 getKimResponsibility();
157 }
158
159 if (null == kimResponsibility) {
160 return "";
161 }
162
163 return kimResponsibility.getNamespaceCode();
164 }
165 }