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

oracle.portal.provider.v2
Class DefaultPortletInstance

java.lang.Object
  extended by oracle.portal.provider.v2.PortletInstance
      extended by oracle.portal.provider.v2.DefaultPortletInstance

public class DefaultPortletInstance
extends PortletInstance

DefaultPortletInstance is the default implementation of a PortletInstance, which carries out the responsibilities of a single 'instance' of a portlet on a single Portal page. A DefaultPortletInstance is driven by meta data information in a DefaultPortletDefinition and thus has the various portlet 'controller objects' at its disposal.


Constructor Summary
DefaultPortletInstance()
           
 
Method Summary
 void copyTo(ProviderUser user, PortletInstance dest)
          Called when the portlet instance is copied to another page.
 void deregister(ProviderUser user)
          Called when the portlet instance is removed from the page.
 java.lang.Object getEditData(ProviderUser user, java.util.Locale locale, RenderContext rc)
          Retrieves an object containing the customizable data for the given user in the given locale within the given context.
 java.lang.Object getEditDefaultData(java.util.Locale locale, RenderContext rc)
          Retrieves an object containing the default data for the PortletInstance in the given locale.
 boolean hasAccess(ProviderUser user, java.util.Locale locale)
          Verifies whether the user is authorized to use this particular portlet instance.
 void init(ProviderInstance providerInstance, PortletDefinition portletDefinition, java.lang.String name, java.util.Locale defLocale)
          Deprecated. Replaced by init(ProviderInstance, PortletDefinition, String, Locale, PerfMonitor)
 void init(ProviderInstance providerInstance, PortletDefinition portletDefinition, java.lang.String name, java.util.Locale defLocale, PerfMonitor perfMonitor)
          Initialize the portlet instance after construction.
 void register(ProviderUser user)
          Called when the portlet instance is first created on a page.
 void render(ProviderUser user, java.util.Locale locale, RenderContext rc)
          Renders a visual representation of this portlet instance for the given user in the given locale in the given context.
 void submitEditData(ProviderUser user, java.util.Locale locale, RenderContext rc, java.lang.Object o)
          Stores an object containing the customizable data for the given user in the given locale within the given context.
 
Methods inherited from class oracle.portal.provider.v2.PortletInstance
exportData, getActionParameterName, getCipherManager, getContextPath, getDefaultLocale, getInstanceName, getPortletDefinition, getPortletId, getPreferenceStore, getProviderId, getProviderInstance, getShortTitle, getTitle, hasTimeoutElapsed, importData
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPortletInstance

public DefaultPortletInstance()
Method Detail

init

public void init(ProviderInstance providerInstance,
                 PortletDefinition portletDefinition,
                 java.lang.String name,
                 java.util.Locale defLocale)
          throws PortletException
Deprecated. Replaced by init(ProviderInstance, PortletDefinition, String, Locale, PerfMonitor)

Initialize the portlet instance after construction.

Overrides:
init in class PortletInstance
Parameters:
providerInstance - Provider of this instance
portletDefinition - definition of this instance. This must be a DefaultPortletDefinition.
name - Portal generated name of this instance
defLocale - the default language/locale setting of the portal, if available, or null if the default locale defined on the PortletDefinition should be used.
Throws:
PortletException - if an error occurs during initialization.

init

public void init(ProviderInstance providerInstance,
                 PortletDefinition portletDefinition,
                 java.lang.String name,
                 java.util.Locale defLocale,
                 PerfMonitor perfMonitor)
          throws PortletException
Initialize the portlet instance after construction.

Overrides:
init in class PortletInstance
Parameters:
providerInstance - Provider of this instance
portletDefinition - definition of this instance. This must be a DefaultPortletDefinition.
name - Portal generated name of this instance
defLocale - the default language/locale setting of the portal, if available, or null if the default locale defined on the PortletDefinition should be used.
perfMonitor - a performance monitor object used for tracking request progress
Throws:
PortletException - if an error occurs during initialization.

register

public void register(ProviderUser user)
              throws java.io.IOException,
                     PortletAlreadyExistsException,
                     AccessControlException
Called when the portlet instance is first created on a page. This gives the DefaultPortletInstance the opportunity to ask its PortletPersonalizationManager to initialize defaults for persisted customization data.

Overrides:
register in class PortletInstance
Parameters:
user - the user performing this operation.
Throws:
java.io.IOException - if an I/O error occurs whilst accessing persistent storage.
PortletAlreadyExistsException - if this instance has already been registered.
AccessControlException - if the given user isn't authorized to access this instance.

deregister

public void deregister(ProviderUser user)
                throws java.io.IOException,
                       PortletNotFoundException,
                       AccessControlException
Called when the portlet instance is removed from the page. This gives the DefaultPortletInstance the opportunity to ask its PortletPersonalizationManager to remove any persisted customization data.

Overrides:
deregister in class PortletInstance
Parameters:
user - the user performing this operation.
Throws:
java.io.IOException - if an I/O error occurs whilst accessing persistent storage.
PortletNotFoundException - if this instance isn't known to exist in the Portal, i.e. hasn't been registered.
AccessControlException - if the given user isn't authorized to access this instance.

copyTo

public void copyTo(ProviderUser user,
                   PortletInstance dest)
            throws java.io.IOException,
                   PortletNotFoundException,
                   AccessControlException
Called when the portlet instance is copied to another page. This gives the DefaultPortletInstance the opportunity to ask its PortletPersonalizationManager to export defaults for persisted customization data to the new instance.

Overrides:
copyTo in class PortletInstance
Parameters:
user - the user performing this operation.
dest - the PortletInstance to export data to.
Throws:
java.io.IOException - if an I/O error occurs whilst accessing persistent storage.
PortletNotFoundException - if this instance or the destination instance isn't known to exist in the Portal, i.e. hasn't been registered.
AccessControlException - if the given user isn't authorized to access this instance or the destination instance.

hasAccess

public boolean hasAccess(ProviderUser user,
                         java.util.Locale locale)
                  throws PortletNotFoundException
Verifies whether the user is authorized to use this particular portlet instance. This implementation uses the portlet's PortletSecurityManager to verify access, if one is defined, or returns true otherwise.

Overrides:
hasAccess in class PortletInstance
Parameters:
user - the current user we are being asked to authorize.
locale - the language setting with which the user has logged on to portal.
Returns:
true if the user is authorized to access this portlet instance.
Throws:
PortletNotFoundException - if this instance isn't known to exist in the Portal, i.e. hasn't been registered.

getEditData

public java.lang.Object getEditData(ProviderUser user,
                                    java.util.Locale locale,
                                    RenderContext rc)
                             throws java.io.IOException,
                                    PortletNotFoundException,
                                    AccessControlException
Retrieves an object containing the customizable data for the given user in the given locale within the given context. If the context is "Edit Defaults" mode, the data should correspond to the defaults for that locale, rather than the data for that specific user.

This implementation first checks whether any customization data has been cached for this portlet instance during this request. If so, it returns it. Otherwise, if a PortletPersonalizationManager is defined for the portlet, it is used to retrieve a PersonalizationObject, which is returned and cached for the duration of this request. Otherwise, null is returned.

Overrides:
getEditData in class PortletInstance
Parameters:
user - the user for whom the data is being retrieved.
locale - the language setting with which the user has logged on to portal.
rc - an object describing the context in which this PortletInstance is being rendered.
Returns:
a PersonalizationObject containing the customizable data for the given user in the given locale within the given context, or null if none exists.
Throws:
java.io.IOException - if an I/O error occurs whilst retrieving the data
PortletNotFoundException - if this instance isn't known to exist in the Portal, i.e. hasn't been registered.
AccessControlException - if the given user isn't authorized to access this instance.

getEditDefaultData

public java.lang.Object getEditDefaultData(java.util.Locale locale,
                                           RenderContext rc)
                                    throws java.io.IOException,
                                           PortletNotFoundException,
                                           AccessControlException
Retrieves an object containing the default data for the PortletInstance in the given locale. If any default data has been previously cached for this portlet instance during this request then it is returned. Otherwise, if a PortletPersonalizationManager is defined for the portlet, it is used to retrieve a PersonalizationObject, which is returned and cached for the duration of this request. Otherwise, null is returned.

Overrides:
getEditDefaultData in class PortletInstance
Parameters:
locale - the language setting with which the user has logged on to Portal.
rc - an object describing the context in which this PortletInstance is being rendered.
Returns:
an object containing the default data for the PortletInstance in the given locale within the given context, or null if none exists.
Throws:
java.io.IOException - if an I/O error occurs whilst retrieving the data
PortletNotFoundException - if this instance isn't known to exist in the Portal, i.e. hasn't been registered.
AccessControlException - if the given user isn't authorized to access this instance.

submitEditData

public void submitEditData(ProviderUser user,
                           java.util.Locale locale,
                           RenderContext rc,
                           java.lang.Object o)
                    throws java.io.IOException,
                           AccessControlException
Stores an object containing the customizable data for the given user in the given locale within the given context. If the context is "Edit Defaults" mode, the data should be stored as the defaults for that locale, rather than the data for that specific user.

This implementation caches the given object for the duration of this request, and if a PortletPersonalizationManager is defined for the portlet, it is used to persist the data so that it is available for subsequent requests.

Overrides:
submitEditData in class PortletInstance
Parameters:
user - the user for whom the data is being stored.
locale - the language setting with which the user has logged on to portal.
rc - an object describing the context in which this PortletInstance is being rendered.
o - an object containing the customizable data for the given user in the given locale within the given context. Should be a PersonalizationObject.
Throws:
java.io.IOException - if an I/O error occurs whilst retrieving the data
AccessControlException - if the given user isn't authorized to access this instance.

render

public void render(ProviderUser user,
                   java.util.Locale locale,
                   RenderContext rc)
            throws AccessControlException,
                   PortletException
Renders a visual representation of this portlet instance for the given user in the given locale in the given context. This implementation uses the portlet's PortletRenderer to perform the rendering.

Specified by:
render in class PortletInstance
Parameters:
user - the user for whom this PortletInstance is being rendered.
locale - the language setting with which the user has logged on to portal.
rc - an object describing the context in which this PortletInstance is being rendered.
Throws:
AccessControlException - if the given user isn't authorized to access this instance.
PortletException - if a general portlet exception occurs whilst rendering.

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.