001/*
002 * Copyright 2011 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/ecl1.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 */
016package org.kuali.rice.kim.impl.jaxb;
017
018import javax.xml.bind.annotation.XmlAccessType;
019import javax.xml.bind.annotation.XmlAccessorType;
020import javax.xml.bind.annotation.XmlElement;
021import javax.xml.bind.annotation.XmlType;
022
023/**
024 * This class represents the <permissionData> element.
025 * 
026 * <p>The expected XML structure is as follows:
027 * 
028 * <br>
029 * <br>&lt;permissionData&gt;
030 * <br>&nbsp;&nbsp;&lt;permissions&gt;
031 * <br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;permission&gt;
032 * <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;permissionName namespaceCode=""&gt;&lt;/permissionName&gt;
033 * <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;templateName namespaceCode=""&gt;&lt;/templateName&gt;
034 * <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;&lt;/description&gt;
035 * <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;active&gt;&lt;/active&gt;
036 * <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;permissionDetails&gt;
037 * <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;permissionDetail key=""&gt;&lt;/permissionDetail&gt;
038 * <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/permissionDetails&gt;
039 * <br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/permission&gt;
040 * <br>&nbsp;&nbsp;&lt;/permissions&gt;
041 * <br>&lt;/permissionData&gt;
042 * 
043 * <p>Note the following:
044 * <ul>
045 *   <li>The &lt;permissions&gt; element is optional, and can contain zero or more &lt;permission&gt; elements.
046 *   <li>The &lt;permissionName&gt; element and its "namespaceCode" attribute are both required.
047 *   The namespace code must map to a valid namespace.
048 *   If the name and namespace combo matches an existing permission, then the permission in the XML
049 *   will overwrite the existing permission.
050 *   <li>The &lt;templateName&gt; element and its "namespaceCode" attribute are both required.
051 *   The name and namespace combo on this element must match a valid permission template.
052 *   <li>The &lt;description&gt; element is required, and must be non-blank.
053 *   <li>The &lt;active&gt; element is optional, and will be set to true if not specified.
054 *   <li>The &lt;permissionDetails&gt; element is optional, and can contain zero or more
055 *   &lt;permissionDetail&gt; elements.
056 *   <li>The &lt;permissionDetail&gt; element's "key" attribute is required, and must be non-blank.
057 *   Duplicate keys within a &lt;permissionDetails&gt; element are not permitted.
058 *   <li>The same permission can be ingested multiple times in the same file, where subsequent ones will
059 *   overwrite previous ones. (TODO: Is this acceptable?)
060 * </ul>
061 * 
062 * TODO: Verify that the above behavior is correct.
063 * 
064 * @author Kuali Rice Team (rice.collab@kuali.org)
065 */
066@XmlAccessorType(XmlAccessType.FIELD)
067@XmlType(name="PermissionDataType", propOrder={"permissions"})
068public class PermissionDataXmlDTO {
069
070    @XmlElement(name="permissions")
071    private PermissionsXmlDTO permissions;
072    
073    public PermissionDataXmlDTO() {}
074    
075    public PermissionDataXmlDTO(PermissionsXmlDTO permissions) {
076        this.permissions = permissions;
077    }
078
079    /**
080     * @return the permissions
081     */
082    public PermissionsXmlDTO getPermissions() {
083        return this.permissions;
084    }
085
086    /**
087     * @param permissions the permissions to set
088     */
089    public void setPermissions(PermissionsXmlDTO permissions) {
090        this.permissions = permissions;
091    }
092}