Oracle Fusion Middleware
Java API Reference for Oracle PDK Java
11g Release 1 (11.1.1)
E10691-01

oracle.portal.provider.v2
Class DefaultPortletDefinition

java.lang.Object
  extended by oracle.portal.provider.v2.PortletDefinition
      extended by oracle.portal.provider.v2.DefaultPortletDefinition
All Implemented Interfaces:
Validateable, InitializableXMLObject

public class DefaultPortletDefinition
extends PortletDefinition
implements InitializableXMLObject

DefaultPortletDefinition extends the base PortletDefinition meta data class with a set of accessors compatible with the DefaultProviderLoader mechanism that loads provider definitions from XML files. It also further simplifies the PortletInstance's task by allowing definition of a number of 'controller objects' to which it can delegate various parts of the portlet's functionality. This is the class most commonly used in the PDK-Java samples to define a portlet.

The table below summarizes the various portlet 'controller classes'.

PortletRendererFor rendering the portlet's visual representation in all the various 'render modes' that it supports.
PortletContainerRendererFor rendering the portlet's headers and footers with a standard 'look and feel'.
PortletPersonalizationManagerFor persisting portlet customization data.
PortletSecurityManagerFor deciding which users can access the portlet and its instances.


Constructor Summary
DefaultPortletDefinition()
           
 
Method Summary
 void addEvent(java.lang.Object event)
          Adds to the array of events that this portlet can raise to Portal
 void addInputParameter(java.lang.Object parameter)
          Adds to the array of (input) parameters that this portlet recognizes when requested to render to control/affect the rendering.
 void deregister(ProviderInstance pi)
          Called on each of a Provider instance's PortletDefinitions when the provider is deregistered from a Portal.
 PortletPersonalizationManager getPersonalizationManager()
          Gets the personalization manager for this portlet.
 PortletRenderer getRenderer()
          Gets the renderer for this portlet.
 PortletSecurityManager getSecurityManager()
          Gets the security manager for this portlet.
 boolean hasAccess(ProviderInstance pi, ProviderUser user)
          Verifies whether the user is authorized to use instances of this PortletDefinition.
 void postInitialize()
          Should be called to complete initialization of this DefaultPortletDefinition.
 void preInitialize(java.lang.Object parent)
          Should be called immediately after construction of a DefaultPortletDefinition to associate it with its parent ProviderDefinition.
 void register(ProviderInstance pi)
          Called on each of a Provider instance's PortletDefinitions when it is first registered on a Portal.
 void setCacheLevel(java.lang.String cacheLevel)
          Sets the caching level used for portlet render requests.
 void setCallGetPortlet(java.lang.String value)
          Controls whether calls to retrieve this Portlet's meta data should be made before displaying it in the portlet repository.
 void setCallIsRunnable(java.lang.String value)
          Controls whether calls to hasAccess(oracle.portal.provider.v2.ProviderInstance, oracle.portal.provider.v2.ProviderUser) should be made to determine whether this portlet is runnable, before displaying it in the portlet repository.
 void setCipherManager(java.lang.Object cipherManager)
          Sets the the CipherManager which will be employed to encrypt exported data and decrypt imported data.
 void setContainerRenderer(java.lang.Object renderer)
          Sets the controller that will render this portlet's container.
 void setDefaultLocale(java.lang.String lang)
          Sets the default Locale for this Portal.
 void setHasAbout(java.lang.String hasAbout)
          Controls whether this portlet displays about information.
 void setHasHelp(java.lang.String hasHelp)
          Controls whether this portlet displays help information.
 void setId(java.lang.String id)
          Sets the Portlet unique ID.
 void setLocalePersonalizationLevel(java.lang.String value)
          Sets the locale personalization level for portlets defined by this PortletDefinition.
 void setMobileFlags(java.lang.String flags)
          Sets the portlet's mobile settings.
 void setPassAllUrlParams(java.lang.String value)
          Controls whether Portal will pass the requested page's URL parameters to the portlet.
 void setPersonalizationManager(java.lang.Object mgr)
          Sets the portlet personalization manager.
 void setPortletBuilder(java.lang.Object portletBuilder)
          Each portlet can specifiy the builder attached to edit this portlet.
 void setPortletInstanceClass(java.lang.String className)
          Defines the PortletInstance subclass that implements the portlet's behaviour.
 void setRenderer(java.lang.Object renderer)
          Sets the portlet renderer.
 void setRewriteUrls(java.lang.String rewriteUrls)
          Controls whether or not URL rewriting will be performed on the results of a portlet render request.
 void setSecurityManager(java.lang.Object mgr)
          Sets the portlet security manager.
 void setShowDetails(java.lang.String hasDetails)
          Controls whether this portlet displays "detailed" mode.
 void setShowEdit(java.lang.String canEdit)
          Controls whether this portlet supports per user personalization.
 void setShowEditDefault(java.lang.String canEditDefault)
          Controls whether this portlet supports per portlet customization.
 void setShowEditToPublic(java.lang.String canEditString)
          Deprecated. use PortletDefinition.setMinEditAuthLevel(java.lang.String) to specify the minimum authentication level needed to edit the portlet.
 void setShowLink(java.lang.String value)
          Controls whether this portlet is capable of rendering content for link mode.
 void setShowPreview(java.lang.String canPreview)
          Controls whether this portlet is capable of displaying a design-time preview of itself (after customization or personalization).
 void setTimeout(java.lang.String timeout)
          Sets the number of seconds the portal should wait before timing out a request to this portlet.
 void validate(java.lang.String context, ValidationError errors)
          Validates the internal state of this DefaultPortletDefinition instance.
 
Methods inherited from class oracle.portal.provider.v2.PortletDefinition
addAcceptContentType, addEvent, addInputParameter, callGetPortlet, callIsRunnable, exportData, getAcceptContentTypes, getCacheLevel, getCipherManager, getContainerRenderer, getContextPath, getDefaultLocale, getDescription, getDescriptionKey, getEvents, getId, getInputParameters, getInstanceNames, getLocalePersonalizationLevel, getMinEditAuthLevel, getMobileFlags, getName, getNameKey, getPassAllUrlParams, getPortletBuilder, getPortletInstanceClass, getPreferenceStore, getProviderDefinition, getResourceBundle, getRewriteUrls, getShortTitle, getShortTitleKey, getShowEditToPublic, getTimeout, getTimeoutMessage, getTimeoutMessageKey, getTitle, getTitleKey, hasAbout, hasHelp, hasShowDetails, hasShowEdit, hasShowEditDefault, hasShowLink, hasShowPreview, importData, init, setCacheLevel, setCallGetPortlet, setCallIsRunnable, setCipherManager, setContainerRenderer, setDefaultLocale, setDescription, setDescriptionKey, setHasAbout, setHasHelp, setId, setLocalePersonalizationLevel, setMinEditAuthLevel, setMobileFlags, setName, setNameKey, setPassAllUrlParams, setPortletBuilder, setPortletInstanceClass, setPrefStoreName, setResource, setRewriteUrls, setShortTitle, setShortTitleKey, setShowDetails, setShowEdit, setShowEditDefault, setShowEditToPublic, setShowLink, setShowPreview, setTimeout, setTimeoutMessage, setTimeoutMessageKey, setTitle, setTitleKey, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPortletDefinition

public DefaultPortletDefinition()
Method Detail

preInitialize

public void preInitialize(java.lang.Object parent)
                   throws NodeHandlerException
Should be called immediately after construction of a DefaultPortletDefinition to associate it with its parent ProviderDefinition.

Specified by:
preInitialize in interface InitializableXMLObject
Parameters:
parent - the parent provider definition object. Sould be a ProviderDefinition or a subclass.
Throws:
NodeHandlerException - if an error occurs while initializing this application object

postInitialize

public void postInitialize()
Should be called to complete initialization of this DefaultPortletDefinition.

Specified by:
postInitialize in interface InitializableXMLObject

setPortletInstanceClass

public void setPortletInstanceClass(java.lang.String className)
                             throws java.lang.ClassNotFoundException
Defines the PortletInstance subclass that implements the portlet's behaviour.

Parameters:
className - the fully qualifed name of the PortletInstance subclass that implements the portlet's behaviour.
Throws:
java.lang.ClassNotFoundException

setId

public void setId(java.lang.String id)
           throws PortletException
Sets the Portlet unique ID.

Parameters:
id - the Portlet (unique ID). Value should be a String representation of a long value, unique with respect to the provider.
Throws:
PortletException - if the given String does not represent a valid long.

addInputParameter

public void addInputParameter(java.lang.Object parameter)
                       throws PortletException
Adds to the array of (input) parameters that this portlet recognizes when requested to render to control/affect the rendering.

Parameters:
parameter - an object representing an input parameter. Should be a ParameterDefinition.
Throws:
PortletException - if the given Object is not a valid ParameterDefinition

addEvent

public void addEvent(java.lang.Object event)
              throws PortletException
Adds to the array of events that this portlet can raise to Portal

Parameters:
event - an object representing an event. Should be a EventDefinition.
Throws:
PortletException - if the given Object is not a valid EventDefinition

setTimeout

public void setTimeout(java.lang.String timeout)
                throws PortletException
Sets the number of seconds the portal should wait before timing out a request to this portlet.

Parameters:
timeout - timeout period, as a String representation of an integer number of seconds.
Throws:
PortletException - if the given String does not represent a valid int.

setShowEdit

public void setShowEdit(java.lang.String canEdit)
Controls whether this portlet supports per user personalization.

Parameters:
canEdit - String representation of boolean value. Should be "true" if this portlet is to support per user personalization, "false" otherwise.

setShowEditToPublic

public void setShowEditToPublic(java.lang.String canEditString)
Deprecated. use PortletDefinition.setMinEditAuthLevel(java.lang.String) to specify the minimum authentication level needed to edit the portlet.

Controls whether this portlet exposes per user personalization to the public non-logged in user.

Parameters:
canEditString - String representation of boolean value. Should be "true" if this portlet exposes per user personalization to the public non-logged in user, "false" otherwise.

setShowEditDefault

public void setShowEditDefault(java.lang.String canEditDefault)
Controls whether this portlet supports per portlet customization. Per portlet customizations means that all users of this instance see a customized version of the portlet vs. the generic version. Users are then free to further personalize this instance (via showEdit).

Parameters:
canEditDefault - String representation of boolean value. Should be "true" if this portlet supports per portlet customization, "false" otherwise.

setShowPreview

public void setShowPreview(java.lang.String canPreview)
Controls whether this portlet is capable of displaying a design-time preview of itself (after customization or personalization).

Parameters:
canPreview - String representation of boolean value. Should be "true" if this portlet is capable of displaying a design-time preview of itself (after customization or personalization), or "false" otherwise.

setShowDetails

public void setShowDetails(java.lang.String hasDetails)
Controls whether this portlet displays "detailed" mode. Detailed mode is a full page mode where this portlet is expected to display a finer level of information.

Parameters:
hasDetails - String representation of boolean value. Should be "true" if this portlet is capable of displaying a "detailed" mode, or "false" otherwise.

setHasHelp

public void setHasHelp(java.lang.String hasHelp)
Controls whether this portlet displays help information.

Parameters:
hasHelp - String representation of boolean value. Should be "true" if this portlet is capable of displaying a help information, or "false" otherwise.

setHasAbout

public void setHasAbout(java.lang.String hasAbout)
Controls whether this portlet displays about information.

Parameters:
hasAbout - String representation of boolean value. Should be "true" if this portlet is capable of displaying about information, or "false" otherwise.

setDefaultLocale

public void setDefaultLocale(java.lang.String lang)
Sets the default Locale for this Portal. The Locale is specified using the standard ISO 2 letter language and country codes, e.g. en.US.

Parameters:
lang - a String specifying a Locale

setShowLink

public void setShowLink(java.lang.String value)
Controls whether this portlet is capable of rendering content for link mode.

Parameters:
value - String representation of boolean value. Should be "true" if this portlet is capable of rendering content for link mode, "false" otherwise.

setCallIsRunnable

public void setCallIsRunnable(java.lang.String value)
Controls whether calls to hasAccess(oracle.portal.provider.v2.ProviderInstance, oracle.portal.provider.v2.ProviderUser) should be made to determine whether this portlet is runnable, before displaying it in the portlet repository.

Parameters:
value - String representation of boolean value. Should be "true" if access checks should be made on a per-user basis before displaying the portlet in the portlet repository. If "false", the portlet is treated as a public portlet visible to all users.

setCallGetPortlet

public void setCallGetPortlet(java.lang.String value)
Controls whether calls to retrieve this Portlet's meta data should be made before displaying it in the portlet repository.

Parameters:
value - String representation of boolean value. If "true", portal will retrieve the portlet meta data before displaying it in the portlet repository. If "false", the default meta data will be used for all users.

setPassAllUrlParams

public void setPassAllUrlParams(java.lang.String value)
Controls whether Portal will pass the requested page's URL parameters to the portlet.

Parameters:
value - String representation of boolean value.

setCacheLevel

public void setCacheLevel(java.lang.String cacheLevel)
                   throws PortletException
Sets the caching level used for portlet render requests. This controls the set of parameters sent to the provider in a render request and hence the "cache key" under which the returned markup is stored. This overrides the User/Session information entered for the provider on registration. The possible settings are:

Parameters:
cacheLevel - String indicates the caching level - should be one of PortletConstants.CACHE_LEVEL_SYSTEM_STR, PortletConstants.CACHE_LEVEL_USER_STR, or PortletConstants.CACHE_LEVEL_SESSION_STR. The cache level for a portlet render request is determined using the following order of precedence:
  • If specified, the portlet setting is used
  • If specified, the provider setting is used
  • If the provider is registered as "public" then the portlet will be called using the "public" user and cached at the system level
  • If the provider is registered as "user" and "portal session data" is requested then portlet will be cached at the session level
  • Otherwise, the portlet will be cached at user level
Throws:
PortletException

setRewriteUrls

public void setRewriteUrls(java.lang.String rewriteUrls)
Controls whether or not URL rewriting will be performed on the results of a portlet render request.

If this method is called then the specified setting will override any equivalent provider setting. If this method is not called then the equivalent provider setting will be used for this portlet.

Parameters:
rewriteUrls - String "true" if URL rewriting is to be performed. Otherwise "false".

setMobileFlags

public void setMobileFlags(java.lang.String flags)
                    throws java.lang.IllegalArgumentException
Sets the portlet's mobile settings. This form allows you to set the flags as a string. The string can either be the (case insensitive) delimited names of the flags or the number itself (as a String). E.g. passing "MOBILE_ONLY | INLINE_OUTPUT" is the same as passing the string "3" to the method. See the MobileFlags class for the possible flags and their String names.

Parameters:
flags - the portlet's mobile flags expressed as a String.
Throws:
java.lang.IllegalArgumentException

setLocalePersonalizationLevel

public void setLocalePersonalizationLevel(java.lang.String value)
                                   throws PortletException
Sets the locale personalization level for portlets defined by this PortletDefinition. For more information regarding the locale personalization level, see PortletDefinition.setLocalePersonalizationLevel(int).

The value supplied should be one of

Failing that, a PortletException will result.

Parameters:
value - the string representation of the locale personalization level.
Throws:
PortletException - if the value is not recognized.

setContainerRenderer

public void setContainerRenderer(java.lang.Object renderer)
                          throws PortletException
Sets the controller that will render this portlet's container.

The container renderer is responsible for rendering the portlet container in each of the show modes the portlet supports.

Parameters:
renderer - the portlet container renderer. Even though the type of the parameter is Object, the parameter must be an instance of PortletContainerRenderer.
Throws:
PortletException - if the given object is not a valid PortletContainerRenderer.

getSecurityManager

public PortletSecurityManager getSecurityManager()
Gets the security manager for this portlet. The security manager is used to check whether a user is authorized to perform a specific action. It is valid for a portlet to not have a security manager. I.e. this method can return null. If there is no security manager it is assumed that all users have unrestricted access.

Returns:
the security manager for this portlet if it has one, or null otherwise.

getPersonalizationManager

public PortletPersonalizationManager getPersonalizationManager()
Gets the personalization manager for this portlet. The personalization manager provides the interface between the renderer and the personalization store that allows the renderer to get the user customizations for this rendition. It is valid for a portlet to not have a personalization manager. I.e. this method can return null.

Returns:
the personalization manager for this portlet if it has one, or null otherwise.

getRenderer

public PortletRenderer getRenderer()
Gets the renderer for this portlet. The renderer is responsible for emitting the visual aspects of the portlet (as markup). All DefaultPortletDefinitions must have a renderer.

Returns:
the renderer for this portlet.

setSecurityManager

public void setSecurityManager(java.lang.Object mgr)
                        throws PortletException
Sets the portlet security manager.

Parameters:
mgr - the portlet security manager. Should be a PortletSecurityManager.
Throws:
PortletException - if the given Object is not a valid PortletSecurityManager

setPersonalizationManager

public void setPersonalizationManager(java.lang.Object mgr)
                               throws PortletException
Sets the portlet personalization manager.

Parameters:
mgr - the personalization manager. Should be a PortletPersonalizationManager.
Throws:
PortletException - if the given Object is not a valid PortletPersonalizationManager

setRenderer

public void setRenderer(java.lang.Object renderer)
                 throws PortletException
Sets the portlet renderer.

Parameters:
renderer - the renderer. Should be a PortletRenderer.
Throws:
PortletException - if the given Object is not a valid PortletRenderer

setCipherManager

public void setCipherManager(java.lang.Object cipherManager)
                      throws PortletException
Sets the the CipherManager which will be employed to encrypt exported data and decrypt imported data. A null value indicates that exported data will not be encrypted. The PortletDefinition level cipher manager overides any set at ProviderDefinition level.

Parameters:
cipherManager - an object of type CipherManager which will be employed to encrypt exported data and decrypt imported data.
Throws:
PortletException

register

public void register(ProviderInstance pi)
              throws java.io.IOException,
                     AccessControlException
Called on each of a Provider instance's PortletDefinitions when it is first registered on a Portal. This gives a DefaultPortletDefinition a chance to ask its PortletPersonalizationManager to initialize storage for the portlet.

Overrides:
register in class PortletDefinition
Throws:
java.io.IOException
AccessControlException

deregister

public void deregister(ProviderInstance pi)
                throws java.io.IOException,
                       AccessControlException
Called on each of a Provider instance's PortletDefinitions when the provider is deregistered from a Portal. This gives a DefaultPortletDefinition a chance to ask its PortletPersonalizationManager to release storage for the portlet.

Overrides:
deregister in class PortletDefinition
Throws:
java.io.IOException
AccessControlException

hasAccess

public boolean hasAccess(ProviderInstance pi,
                         ProviderUser user)
Verifies whether the user is authorized to use instances of this PortletDefinition. That is, does this user have the necessary privileges to create, get, copy, and destroy instances of this PortletDefinition. A DefaultPortletDefinition is able to use its PortletSecurityManager to perform this check.

Overrides:
hasAccess in class PortletDefinition
Parameters:
user - the current user we are being asked to authorize.
Returns:
true is this user is authorized to access this portlet.

setPortletBuilder

public void setPortletBuilder(java.lang.Object portletBuilder)
                       throws PortletException
Each portlet can specifiy the builder attached to edit this portlet. This method sets a PortletBuilder with this portletdefinition.

Parameters:
portletBuilder - the PortletBuilder attribute for this Portlet
Throws:
PortletException - if the given Object is not a valid BuilderMetaData.

validate

public void validate(java.lang.String context,
                     ValidationError errors)
Validates the internal state of this DefaultPortletDefinition instance. Errors found are reported using the supplied ValidationError instance.

Specified by:
validate in interface Validateable
Overrides:
validate in class PortletDefinition
Parameters:
context - The context of the calling instance.
errors - The current list of errors.

Oracle Fusion Middleware
Java API Reference for Oracle PDK Java
11g Release 1 (11.1.1)
E10691-01

Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.