001: /**
002: *
003: * Licensed to the Apache Software Foundation (ASF) under one or more
004: * contributor license agreements. See the NOTICE file distributed with
005: * this work for additional information regarding copyright ownership.
006: * The ASF licenses this file to You under the Apache License, Version 2.0
007: * (the "License"); you may not use this file except in compliance with
008: * the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing, software
013: * distributed under the License is distributed on an "AS IS" BASIS,
014: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: * See the License for the specific language governing permissions and
016: * limitations under the License.
017: */package org.apache.openejb.jee;
018:
019: import javax.xml.bind.annotation.XmlAccessType;
020: import javax.xml.bind.annotation.XmlAccessorType;
021: import javax.xml.bind.annotation.XmlAttribute;
022: import javax.xml.bind.annotation.XmlElement;
023: import javax.xml.bind.annotation.XmlID;
024: import javax.xml.bind.annotation.XmlType;
025: import javax.xml.bind.annotation.XmlTransient;
026: import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
027: import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
028: import java.util.ArrayList;
029: import java.util.List;
030:
031: /**
032: * The method-permissionType specifies that one or more
033: * security roles are allowed to invoke one or more enterprise
034: * bean methods. The method-permissionType consists of an
035: * optional description, a list of security role names or an
036: * indicator to state that the method is unchecked for
037: * authorization, and a list of method elements.
038: * <p/>
039: * The security roles used in the method-permissionType
040: * must be defined in the security-role elements of the
041: * deployment descriptor, and the methods must be methods
042: * defined in the enterprise bean's business, home, component
043: * and/or web service endpoint interfaces.
044: */
045: @XmlAccessorType(XmlAccessType.FIELD)
046: @XmlType(name="method-permissionType",propOrder={"descriptions","roleName","unchecked","method"})
047: public class MethodPermission {
048:
049: @XmlElement(name="role-name",required=true)
050: protected List<String> roleName;
051: protected EmptyType unchecked;
052: @XmlElement(required=true)
053: protected List<Method> method;
054: @XmlAttribute
055: @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
056: @XmlID
057: protected String id;
058:
059: @XmlTransient
060: protected TextMap description = new TextMap();
061:
062: @XmlElement(name="description",required=true)
063: public Text[] getDescriptions() {
064: return description.toArray();
065: }
066:
067: public void setDescriptions(Text[] text) {
068: description.set(text);
069: }
070:
071: public String getDescription() {
072: return description.get();
073: }
074:
075: public List<String> getRoleName() {
076: if (roleName == null) {
077: roleName = new ArrayList<String>();
078: }
079: return this .roleName;
080: }
081:
082: public boolean getUnchecked() {
083: return unchecked != null;
084: }
085:
086: public void setUnchecked(boolean b) {
087: this .unchecked = (b) ? new EmptyType() : null;
088: }
089:
090: public List<Method> getMethod() {
091: if (method == null) {
092: method = new ArrayList<Method>();
093: }
094: return this .method;
095: }
096:
097: public String getId() {
098: return id;
099: }
100:
101: public void setId(String value) {
102: this.id = value;
103: }
104:
105: }
|