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 | 0 | @XmlTransient |
72 | |
private boolean alreadyPersisted = false; |
73 | |
|
74 | |
@XmlTransient |
75 | |
private Set<String> existingRoleMemberIds; |
76 | |
|
77 | 0 | public RoleXmlDTO() { |
78 | 0 | this.active = Boolean.TRUE; |
79 | 0 | } |
80 | |
|
81 | 0 | public RoleXmlDTO(RoleContract role, RoleMembersXmlDTO.WithinRole roleMembers, RolePermissionsXmlDTO.WithinRole rolePermissions) { |
82 | 0 | if (role == null) { |
83 | 0 | throw new IllegalArgumentException("role cannot be null"); |
84 | |
} |
85 | |
|
86 | 0 | this.roleNameAndNamespace = new NameAndNamespacePair(role.getNamespaceCode(), role.getName()); |
87 | 0 | this.kimTypeId = role.getKimTypeId(); |
88 | 0 | this.roleDescription = role.getDescription(); |
89 | 0 | this.active = Boolean.valueOf(role.isActive()); |
90 | 0 | this.roleMembers = roleMembers; |
91 | 0 | this.rolePermissions = rolePermissions; |
92 | 0 | } |
93 | |
|
94 | |
|
95 | |
|
96 | |
|
97 | |
public String getRoleId() { |
98 | 0 | return this.roleId; |
99 | |
} |
100 | |
|
101 | |
|
102 | |
|
103 | |
|
104 | |
public void setRoleId(String roleId) { |
105 | 0 | this.roleId = roleId; |
106 | 0 | } |
107 | |
|
108 | |
|
109 | |
|
110 | |
|
111 | |
public NameAndNamespacePair getRoleNameAndNamespace() { |
112 | 0 | return this.roleNameAndNamespace; |
113 | |
} |
114 | |
|
115 | |
|
116 | |
|
117 | |
|
118 | |
public void setRoleNameAndNamespace(NameAndNamespacePair roleNameAndNamespace) { |
119 | 0 | this.roleNameAndNamespace = roleNameAndNamespace; |
120 | 0 | } |
121 | |
|
122 | |
|
123 | |
|
124 | |
|
125 | |
public String getKimTypeId() { |
126 | 0 | return this.kimTypeId; |
127 | |
} |
128 | |
|
129 | |
|
130 | |
|
131 | |
|
132 | |
public void setKimTypeId(String kimTypeId) { |
133 | 0 | this.kimTypeId = kimTypeId; |
134 | 0 | } |
135 | |
|
136 | |
|
137 | |
|
138 | |
|
139 | |
public String getRoleDescription() { |
140 | 0 | return this.roleDescription; |
141 | |
} |
142 | |
|
143 | |
|
144 | |
|
145 | |
|
146 | |
public void setRoleDescription(String roleDescription) { |
147 | 0 | this.roleDescription = roleDescription; |
148 | 0 | } |
149 | |
|
150 | |
|
151 | |
|
152 | |
|
153 | |
public Boolean getActive() { |
154 | 0 | return this.active; |
155 | |
} |
156 | |
|
157 | |
|
158 | |
|
159 | |
|
160 | |
public void setActive(Boolean active) { |
161 | 0 | this.active = active; |
162 | 0 | } |
163 | |
|
164 | |
|
165 | |
|
166 | |
|
167 | |
public RoleMembersXmlDTO.WithinRole getRoleMembers() { |
168 | 0 | return this.roleMembers; |
169 | |
} |
170 | |
|
171 | |
|
172 | |
|
173 | |
|
174 | |
public void setRoleMembers(RoleMembersXmlDTO.WithinRole roleMembers) { |
175 | 0 | this.roleMembers = roleMembers; |
176 | 0 | } |
177 | |
|
178 | |
|
179 | |
|
180 | |
|
181 | |
public RolePermissionsXmlDTO.WithinRole getRolePermissions() { |
182 | 0 | return this.rolePermissions; |
183 | |
} |
184 | |
|
185 | |
|
186 | |
|
187 | |
|
188 | |
public void setRolePermissions(RolePermissionsXmlDTO.WithinRole rolePermissions) { |
189 | 0 | this.rolePermissions = rolePermissions; |
190 | 0 | } |
191 | |
|
192 | |
|
193 | |
|
194 | |
|
195 | |
public boolean isAlreadyPersisted() { |
196 | 0 | return this.alreadyPersisted; |
197 | |
} |
198 | |
|
199 | |
|
200 | |
|
201 | |
|
202 | |
public void setAlreadyPersisted(boolean alreadyPersisted) { |
203 | 0 | this.alreadyPersisted = alreadyPersisted; |
204 | 0 | } |
205 | |
|
206 | |
|
207 | |
|
208 | |
|
209 | |
public Set<String> getExistingRoleMemberIds() { |
210 | 0 | return this.existingRoleMemberIds; |
211 | |
} |
212 | |
|
213 | |
|
214 | |
|
215 | |
|
216 | |
public void setExistingRoleMemberIds(Set<String> existingRoleMemberIds) { |
217 | 0 | this.existingRoleMemberIds = existingRoleMemberIds; |
218 | 0 | } |
219 | |
|
220 | |
|
221 | |
|
222 | |
|
223 | |
|
224 | |
|
225 | |
public String getRoleName() { |
226 | 0 | return (roleNameAndNamespace != null) ? roleNameAndNamespace.getName() : null; |
227 | |
} |
228 | |
|
229 | |
|
230 | |
|
231 | |
|
232 | |
|
233 | |
|
234 | |
public String getNamespaceCode() { |
235 | 0 | return (roleNameAndNamespace != null) ? roleNameAndNamespace.getNamespaceCode() : null; |
236 | |
} |
237 | |
} |