📄 portletapptype.java.svn-base
字号:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.apache.pluto.descriptors.portlet;import java.util.ArrayList;import java.util.List;import javax.xml.XMLConstants;import javax.xml.bind.annotation.XmlAccessType;import javax.xml.bind.annotation.XmlAccessorType;import javax.xml.bind.annotation.XmlAttribute;import javax.xml.bind.annotation.XmlElement;import javax.xml.bind.annotation.XmlRootElement;import javax.xml.bind.annotation.XmlSchemaType;import javax.xml.bind.annotation.XmlTransient;import javax.xml.bind.annotation.XmlType;import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;import javax.xml.namespace.QName;import org.apache.pluto.om.portlet.ContainerRuntimeOption;import org.apache.pluto.om.portlet.CustomPortletMode;import org.apache.pluto.om.portlet.CustomWindowState;import org.apache.pluto.om.portlet.EventDefinition;import org.apache.pluto.om.portlet.Filter;import org.apache.pluto.om.portlet.FilterMapping;import org.apache.pluto.om.portlet.Listener;import org.apache.pluto.om.portlet.PortletDefinition;import org.apache.pluto.om.portlet.PortletApplicationDefinition;import org.apache.pluto.om.portlet.PublicRenderParameter;import org.apache.pluto.om.portlet.SecurityConstraint;import org.apache.pluto.om.portlet.UserAttribute;/** * <p>Java class for portlet-appType complex type. <p>The following schema fragment specifies the expected content * contained within this class. * * <pre> * <complexType name="portlet-appType"> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element name="portlet" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}portletType" maxOccurs="unbounded" minOccurs="0"/> * <element name="custom-portlet-mode" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}custom-portlet-modeType" maxOccurs="unbounded" minOccurs="0"/> * <element name="custom-window-state" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}custom-window-stateType" maxOccurs="unbounded" minOccurs="0"/> * <element name="user-attribute" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}user-attributeType" maxOccurs="unbounded" minOccurs="0"/> * <element name="security-constraint" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}security-constraintType" maxOccurs="unbounded" minOccurs="0"/> * <element name="resource-bundle" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}resource-bundleType" minOccurs="0"/> * <element name="filter" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}filterType" maxOccurs="unbounded" minOccurs="0"/> * <element name="filter-mapping" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}filter-mappingType" maxOccurs="unbounded" minOccurs="0"/> * <element name="default-namespace" type="{http://www.w3.org/2001/XMLSchema}anyURI" minOccurs="0"/> * <element name="event-definition" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}event-definitionType" maxOccurs="unbounded" minOccurs="0"/> * <element name="public-render-parameter" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}public-render-parameterType" maxOccurs="unbounded" minOccurs="0"/> * <element name="listener" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}listenerType" maxOccurs="unbounded" minOccurs="0"/> * <element name="container-runtime-option" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}container-runtime-optionType" maxOccurs="unbounded" minOccurs="0"/> * </sequence> * <attribute name="version" use="required" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" /> * <attribute name="id" type="{http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd}string" /> * </restriction> * </complexContent> * </complexType> * </pre> * * @version $Id$ */@XmlRootElement(name = "portlet-app")@XmlAccessorType(XmlAccessType.FIELD)@XmlType(name = "portlet-appType", propOrder = { "portlet", "customPortletMode", "customWindowState", "userAttribute", "securityConstraint", "resourceBundle", "filter", "filterMapping", "defaultNamespace", "eventDefinition", "publicRenderParameter", "listener", "containerRuntimeOption" })public class PortletAppType implements PortletApplicationDefinition{ @XmlElement(name = "portlet") protected List<PortletType> portlet; @XmlElement(name = "custom-portlet-mode") protected List<CustomPortletModeType> customPortletMode; @XmlElement(name = "custom-window-state") protected List<CustomWindowStateType> customWindowState; @XmlElement(name = "user-attribute") protected List<UserAttributeType> userAttribute; @XmlElement(name = "security-constraint") protected List<SecurityConstraintType> securityConstraint; @XmlElement(name = "resource-bundle") @XmlJavaTypeAdapter(value=CollapsedStringAdapter.class) protected String resourceBundle; @XmlElement(name = "filter") protected List<FilterType> filter; @XmlElement(name = "filter-mapping") protected List<FilterMappingType> filterMapping; @XmlElement(name = "default-namespace") @XmlSchemaType(name = "anyURI") protected String defaultNamespace; @XmlElement(name = "event-definition") protected List<EventDefinitionType> eventDefinition; @XmlElement(name = "public-render-parameter") protected List<PublicRenderParameterType> publicRenderParameter; @XmlElement(name = "listener") protected List<ListenerType> listener; @XmlElement(name = "container-runtime-option") protected List<ContainerRuntimeOptionType> containerRuntimeOption; @XmlAttribute(required = true) protected String version = JSR_286_VERSION; @XmlTransient protected String name; public String getName() { return name; } public void setName(String name) { this.name = name; } public PortletDefinition getPortlet(String portletName) { for (PortletDefinition pd : getPortlets()) { if (pd.getPortletName().equals(portletName)) { return pd; } } return null; } public List<? extends PortletDefinition> getPortlets() { if (portlet == null) { portlet = new ArrayList<PortletType>(); } return portlet; } public PortletDefinition addPortlet(String portletName) { if (getPortlet(portletName) != null) { throw new IllegalArgumentException("Portlet with name: "+portletName+" already defined"); } PortletType p = new PortletType(); p.setPortletName(portletName); p.setApplication(this); portlet.add(p); return p; } public CustomPortletMode getCustomPortletMode(String name) { for (CustomPortletMode cpm : getCustomPortletModes()) { if (cpm.getPortletMode().equalsIgnoreCase(name)) { return cpm; } } return null; } public List<? extends CustomPortletMode> getCustomPortletModes() { if (customPortletMode == null) { customPortletMode = new ArrayList<CustomPortletModeType>(); } return customPortletMode; } public CustomPortletMode addCustomPortletMode(String name) { if (getCustomPortletMode(name) != null) { throw new IllegalArgumentException("Custom PortletMode with mode name: "+name+" already defined"); } CustomPortletModeType cpm = new CustomPortletModeType(); cpm.setPortletMode(name); customPortletMode.add(cpm); return cpm; } public CustomWindowState getCustomWindowState(String name) { for (CustomWindowState cws : getCustomWindowStates()) { if (cws.getWindowState().equalsIgnoreCase(name)) { return cws; } } return null; } public List<? extends CustomWindowState> getCustomWindowStates() { if (customWindowState == null) { customWindowState = new ArrayList<CustomWindowStateType>(); } return customWindowState; } public CustomWindowState addCustomWindowState(String name) { if (getCustomWindowState(name) != null) { throw new IllegalArgumentException("Custom WindowState with state name: "+name+" already defined"); } CustomWindowStateType cws = new CustomWindowStateType(); cws.setWindowState(name); customWindowState.add(cws); return cws; } public UserAttribute getUserAttribute(String name) { for (UserAttribute ua : getUserAttributes()) { if (ua.getName().equals(name)) { return ua; } } return null; } public List<? extends UserAttribute> getUserAttributes() { if (userAttribute == null) { userAttribute = new ArrayList<UserAttributeType>(); } return userAttribute; } public UserAttribute addUserAttribute(String name) { if (getUserAttribute(name) != null) { throw new IllegalArgumentException("User attribute with name: "+name+" already defined"); } UserAttributeType ua = new UserAttributeType(); ua.setName(name);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -