1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kim.impl.jaxb;
17
18 import java.io.Serializable;
19 import java.util.Set;
20
21 import javax.xml.bind.annotation.XmlAccessType;
22 import javax.xml.bind.annotation.XmlAccessorType;
23 import javax.xml.bind.annotation.XmlElement;
24 import javax.xml.bind.annotation.XmlTransient;
25 import javax.xml.bind.annotation.XmlType;
26 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
27
28 import org.kuali.rice.core.util.jaxb.NameAndNamespacePair;
29 import org.kuali.rice.core.util.jaxb.NameAndNamespacePairValidatingAdapter;
30 import org.kuali.rice.core.util.jaxb.StringTrimmingAdapter;
31 import org.kuali.rice.kim.api.jaxb.NameAndNamespacePairToKimTypeIdAdapter;
32 import org.kuali.rice.kim.api.role.RoleContract;
33
34
35
36
37
38
39 @XmlAccessorType(XmlAccessType.FIELD)
40 @XmlType(name="RoleType", propOrder={
41 "roleNameAndNamespace", "kimTypeId", "roleDescription", "active", "roleMembers", "rolePermissions"
42 })
43 public class RoleXmlDTO implements Serializable {
44
45 private static final long serialVersionUID = 1L;
46
47 @XmlTransient
48 private String roleId;
49
50 @XmlElement(name="roleName")
51 @XmlJavaTypeAdapter(NameAndNamespacePairValidatingAdapter.class)
52 private NameAndNamespacePair roleNameAndNamespace;
53
54 @XmlElement(name="kimTypeName")
55 @XmlJavaTypeAdapter(NameAndNamespacePairToKimTypeIdAdapter.class)
56 private String kimTypeId;
57
58 @XmlElement(name="description")
59 @XmlJavaTypeAdapter(StringTrimmingAdapter.class)
60 private String roleDescription;
61
62 @XmlElement(name="active")
63 private Boolean active;
64
65 @XmlElement(name="roleMembers")
66 private RoleMembersXmlDTO.WithinRole roleMembers;
67
68 @XmlElement(name="rolePermissions")
69 private RolePermissionsXmlDTO.WithinRole rolePermissions;
70
71 @XmlTransient
72 private boolean alreadyPersisted = false;
73
74 @XmlTransient
75 private Set<String> existingRoleMemberIds;
76
77 public RoleXmlDTO() {
78 this.active = Boolean.TRUE;
79 }
80
81 public RoleXmlDTO(RoleContract role, RoleMembersXmlDTO.WithinRole roleMembers, RolePermissionsXmlDTO.WithinRole rolePermissions) {
82 if (role == null) {
83 throw new IllegalArgumentException("role cannot be null");
84 }
85
86 this.roleNameAndNamespace = new NameAndNamespacePair(role.getNamespaceCode(), role.getName());
87 this.kimTypeId = role.getKimTypeId();
88 this.roleDescription = role.getDescription();
89 this.active = Boolean.valueOf(role.isActive());
90 this.roleMembers = roleMembers;
91 this.rolePermissions = rolePermissions;
92 }
93
94
95
96
97 public String getRoleId() {
98 return this.roleId;
99 }
100
101
102
103
104 public void setRoleId(String roleId) {
105 this.roleId = roleId;
106 }
107
108
109
110
111 public NameAndNamespacePair getRoleNameAndNamespace() {
112 return this.roleNameAndNamespace;
113 }
114
115
116
117
118 public void setRoleNameAndNamespace(NameAndNamespacePair roleNameAndNamespace) {
119 this.roleNameAndNamespace = roleNameAndNamespace;
120 }
121
122
123
124
125 public String getKimTypeId() {
126 return this.kimTypeId;
127 }
128
129
130
131
132 public void setKimTypeId(String kimTypeId) {
133 this.kimTypeId = kimTypeId;
134 }
135
136
137
138
139 public String getRoleDescription() {
140 return this.roleDescription;
141 }
142
143
144
145
146 public void setRoleDescription(String roleDescription) {
147 this.roleDescription = roleDescription;
148 }
149
150
151
152
153 public Boolean getActive() {
154 return this.active;
155 }
156
157
158
159
160 public void setActive(Boolean active) {
161 this.active = active;
162 }
163
164
165
166
167 public RoleMembersXmlDTO.WithinRole getRoleMembers() {
168 return this.roleMembers;
169 }
170
171
172
173
174 public void setRoleMembers(RoleMembersXmlDTO.WithinRole roleMembers) {
175 this.roleMembers = roleMembers;
176 }
177
178
179
180
181 public RolePermissionsXmlDTO.WithinRole getRolePermissions() {
182 return this.rolePermissions;
183 }
184
185
186
187
188 public void setRolePermissions(RolePermissionsXmlDTO.WithinRole rolePermissions) {
189 this.rolePermissions = rolePermissions;
190 }
191
192
193
194
195 public boolean isAlreadyPersisted() {
196 return this.alreadyPersisted;
197 }
198
199
200
201
202 public void setAlreadyPersisted(boolean alreadyPersisted) {
203 this.alreadyPersisted = alreadyPersisted;
204 }
205
206
207
208
209 public Set<String> getExistingRoleMemberIds() {
210 return this.existingRoleMemberIds;
211 }
212
213
214
215
216 public void setExistingRoleMemberIds(Set<String> existingRoleMemberIds) {
217 this.existingRoleMemberIds = existingRoleMemberIds;
218 }
219
220
221
222
223
224
225 public String getRoleName() {
226 return (roleNameAndNamespace != null) ? roleNameAndNamespace.getName() : null;
227 }
228
229
230
231
232
233
234 public String getNamespaceCode() {
235 return (roleNameAndNamespace != null) ? roleNameAndNamespace.getNamespaceCode() : null;
236 }
237 }