001 /**
002 * Copyright 2005-2013 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.rice.kim.impl.jaxb;
017
018 import java.io.Serializable;
019
020 import javax.xml.bind.annotation.XmlAccessType;
021 import javax.xml.bind.annotation.XmlAccessorType;
022 import javax.xml.bind.annotation.XmlElement;
023 import javax.xml.bind.annotation.XmlType;
024
025 /**
026 * This class represents a <roleData> element.
027 *
028 * <p>The expected XML structure is as follows:
029 *
030 * <br>
031 * <br><roleData>
032 * <br> <roles>
033 * <br> <role>
034 * <br> <roleName namespaceCode=""></roleName>
035 * <br> <kimTypeName namespaceCode=""></kimTypeName>
036 * <br> <description></description>
037 * <br> <active></active>
038 * <br> <roleMembers>
039 * <br> <roleMember>
040 * <br> <principalId></principalId>
041 * <br> <principalName></principalName>
042 * <br> <groupId></groupId>
043 * <br> <groupName namespaceCode=""></groupName>
044 * <br> <roleIdAsMember></roleIdAsMember>
045 * <br> <roleNameAsMember namespaceCode=""></roleNameAsMember>
046 * <br> <activeFromDate></activeFromDate>
047 * <br> <activeToDate></activeToDate>
048 * <br> <qualifications>
049 * <br> <qualification key=""></qualification>
050 * <br> </qualifications>
051 * <br> </roleMember>
052 * <br> </roleMembers>
053 * <br> <rolePermissions>
054 * <br> <rolePermission>
055 * <br> <permissionId></permissionId>
056 * <br> <permissionName namespaceCode=""></permissionName>
057 * <br> </rolePermission>
058 * <br> </rolePermissions>
059 * <br> </role>
060 * <br> </roles>
061 * <br> <roleMembers>
062 * <br> <roleMember>
063 * <br> <roleId></roleId>
064 * <br> <roleName namespaceCode=""></roleName>
065 * <br> <principalId></principalId>
066 * <br> <principalName></principalName>
067 * <br> <groupId></groupId>
068 * <br> <groupName namespaceCode=""></groupName>
069 * <br> <roleIdAsMember></roleIdAsMember>
070 * <br> <roleNameAsMember namespaceCode=""></roleNameAsMember>
071 * <br> <activeFromDate></activeFromDate>
072 * <br> <activeToDate></activeToDate>
073 * <br> <qualifications>
074 * <br> <qualification key=""></qualification>
075 * <br> </qualifications>
076 * <br> </roleMember>
077 * <br> </roleMembers>
078 * <br> <rolePermissions>
079 * <br> <rolePermission>
080 * <br> <roleId></roleId>
081 * <br> <roleName namespaceCode=""></roleName>
082 * <br> <permissionId></permissionId>
083 * <br> <permissionName namespaceCode=""></permissionName>
084 * <br> </rolePermission>
085 * <br> </rolePermissions>
086 * <br></roleData>
087 *
088 * <p>Note the following:
089 * <ul>
090 * <li>The <roles> element is optional, and can contain zero or more <role> elements.
091 * <li>The <roleName> element on the <role> element and its "namespaceCode" attribute
092 * are required, and must be non-blank. The namespace code must map to a valid namespace.
093 * If the name and namespace combo matches an existing role, then the role in the XML will
094 * overwrite the existing role.
095 * <li>The <kimTypeName> and its "namespaceCode" attribute are both required, and the
096 * name and namespace combo must match an existing KIM type.
097 * <li>The <description> element is required, and must be non-blank.
098 * <li>The <active> element is optional, and will be set to true if not specified.
099 * <li>Both <roleMembers> elements are optional, and can contain zero or more
100 * <roleMember> elements. If the <roleMembers> element within the <role>
101 * element is specified, then any role members that are not within that element will be removed
102 * from the role if the XML is overwriting an existing one. (The <roleMembers> element
103 * outside of the <role> element can still add or re-add members that are not located
104 * within the other <roleMembers> element.)
105 * <li>For both <roleMember> elements:
106 * <ul>
107 * <li>Exactly one of these sets of member identification must be specified:
108 * <ol>
109 * <li>A <principalId> and/or <principalName> element, where the former
110 * must contain a valid principal ID and the latter must contain a valid principal name.
111 * <li>A <groupId> and/or <groupName> element, where the former must contain
112 * a valid group ID and the latter must contain a valid group name and namespace.
113 * <li>A <roleIdAsMember> and/or <roleNameAsMember> element, where the former
114 * must contain a valid role ID and the latter must contain a valid role name and namespace.
115 * </ol>
116 * <li>The <activeFromDate> element is optional, and its content must be a date String
117 * that can be parsed by the DateTimeService.
118 * <li>The <activeToDate> element is optional, and its content must be a date String
119 * that can be parsed by the DateTimeService.
120 * <li>The <qualifications> element is optional, and can contain zero or more
121 * <qualification> elements.
122 * <li>The <qualification> element's "key" attribute is required, and must be non-blank.
123 * Duplicate keys within a <qualifications> element are not permitted.
124 * </ul>
125 * <li>For both <rolePermission> elements:
126 * <ul>
127 * <li>A <permissionId> and/or <permissionName> element must be specified, where the
128 * former must contain a valid permission ID and the latter must contain a valid permission
129 * name and namespace.
130 * </ul>
131 * <li>For the <roleMember> and <rolePermission> elements not inside a <role> element:
132 * <ul>
133 * <li>A <roleId> and/or <roleName> element must be specified, where the former must
134 * contain a valid role ID and the latter must contain a valid role name and namespace.
135 * </ul>
136 * <li>The ingestion process is currently order-dependent, which should be kept in mind when adding
137 * roles as members of another role or assigning permissions to roles. (The permission XML always
138 * gets ingested prior to the role XML.)
139 * <li>The assignments of permissions to roles can only be added, not removed or deactivated.
140 * (TODO: Improve the role/permission-updating API to allow for updates and removals.)
141 * <li>The same roles, role members, and role permissions can be ingested within the same file,
142 * where subsequent ones will overwrite previous ones. (TODO: Is this acceptable?)
143 * <li>The IDs of principals, groups, roles, and permissions are not included when exporting the XML.
144 * <li>Delegations and responsibility actions are currently not supported by the ingestion process.
145 * </ul>
146 *
147 * TODO: Verify that the above behavior is correct.
148 *
149 * @author Kuali Rice Team (rice.collab@kuali.org)
150 */
151 @XmlAccessorType(XmlAccessType.FIELD)
152 @XmlType(name="RoleDataType", propOrder={"roles", "roleMembers", "rolePermissions"})
153 public class RoleDataXmlDTO implements Serializable {
154
155 private static final long serialVersionUID = 1L;
156
157 @XmlElement(name="roles")
158 private RolesXmlDTO roles;
159
160 @XmlElement(name="roleMembers")
161 private RoleMembersXmlDTO.OutsideOfRole roleMembers;
162
163 @XmlElement(name="rolePermissions")
164 private RolePermissionsXmlDTO.OutsideOfRole rolePermissions;
165
166 public RoleDataXmlDTO() {}
167
168 public RoleDataXmlDTO(RolesXmlDTO roles) {
169 this.roles = roles;
170 }
171
172 /**
173 * @return the roles
174 */
175 public RolesXmlDTO getRoles() {
176 return this.roles;
177 }
178
179 /**
180 * @param roles the roles to set
181 */
182 public void setRoles(RolesXmlDTO roles) {
183 this.roles = roles;
184 }
185
186 /**
187 * @return the roleMembers
188 */
189 public RoleMembersXmlDTO.OutsideOfRole getRoleMembers() {
190 return this.roleMembers;
191 }
192
193 /**
194 * @param roleMembers the roleMembers to set
195 */
196 public void setRoleMembers(RoleMembersXmlDTO.OutsideOfRole roleMembers) {
197 this.roleMembers = roleMembers;
198 }
199
200 /**
201 * @return the rolePermissions
202 */
203 public RolePermissionsXmlDTO.OutsideOfRole getRolePermissions() {
204 return this.rolePermissions;
205 }
206
207 /**
208 * @param rolePermissions the rolePermissions to set
209 */
210 public void setRolePermissions(RolePermissionsXmlDTO.OutsideOfRole rolePermissions) {
211 this.rolePermissions = rolePermissions;
212 }
213
214 }