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
56 @Column(name="VER_NBR")
57 protected Long versionNumber = (long) 0;
58 @Transient
59 protected ResponsibilityBo kimResponsibility;
60 @Transient
61 protected List<KimDocumentRoleResponsibilityAction> roleRspActions = new AutoPopulatingList(KimDocumentRoleResponsibilityAction.class);
62 @Transient
63 protected String name;
64 @Transient
65 protected String namespaceCode;
66
67 public String getRoleId() {
68 return roleId;
69 }
70
71 public void setRoleId(String roleId) {
72 this.roleId = roleId;
73 }
74
75 public void setRoleResponsibilityId(String roleResponsibilityId) {
76 this.roleResponsibilityId = roleResponsibilityId;
77 }
78
79
80
81
82 public String getRoleResponsibilityId() {
83 return this.roleResponsibilityId;
84 }
85
86
87
88
89 public ResponsibilityBo getKimResponsibility() {
90 if ( kimResponsibility == null && responsibilityId != null ) {
91
92
93
94 Responsibility info = KimApiServiceLocator.getResponsibilityService().getResponsibility(getResponsibilityId());
95 kimResponsibility = ResponsibilityBo.from(info);
96 }
97 return this.kimResponsibility;
98 }
99
100
101
102
103 public void setResponsibilityId(String responsibilityId) {
104 this.responsibilityId = responsibilityId;
105 }
106
107
108
109
110 public void setKimResponsibility(ResponsibilityBo kimResponsibility) {
111 this.kimResponsibility = kimResponsibility;
112 }
113
114
115
116
117 public String getResponsibilityId() {
118 return this.responsibilityId;
119 }
120
121
122
123
124 public KimDocumentRoleResponsibilityAction getRoleRspAction() {
125 if(this.roleRspActions!=null && this.roleRspActions.size()>0)
126 return this.roleRspActions.get(0);
127 return null;
128 }
129
130
131
132
133 public List<KimDocumentRoleResponsibilityAction> getRoleRspActions() {
134 return this.roleRspActions;
135 }
136
137
138
139
140 public void setRoleRspActions(
141 List<KimDocumentRoleResponsibilityAction> roleRspActions) {
142 this.roleRspActions = roleRspActions;
143 }
144
145 public String getName(){
146 if( null == kimResponsibility ) {
147 getKimResponsibility();
148 }
149
150 if (null == kimResponsibility) {
151 return "";
152 }
153
154 return kimResponsibility.getName();
155 }
156
157 public String getNamespaceCode(){
158 if( null == kimResponsibility ) {
159 getKimResponsibility();
160 }
161
162 if (null == kimResponsibility) {
163 return "";
164 }
165
166 return kimResponsibility.getNamespaceCode();
167 }
168 }