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

oracle.portal.provider.v2.personalize
Class PrefStorePersonalizationManager

java.lang.Object
  extended by oracle.portal.provider.v2.personalize.PortletPersonalizationManager
      extended by oracle.portal.provider.v2.personalize.PrefStorePersonalizationManager
All Implemented Interfaces:
Validateable, InitializableXMLObject

public class PrefStorePersonalizationManager
extends PortletPersonalizationManager
implements InitializableXMLObject

The PrefStorePersonalizationManager class implements a PortletPersonalizationManager using a PreferenceStore to persist customized data objects.

The class of the data objects managed by a PrefStorePersonalizationManager is registered using PortletPersonalizationManager.setDataClass(String). Most commonly this will be the result of a declaration in the provider XML registry (e.g. <dataClass>className</dataClass>). For maximum extensibility, it is recommended that you use NameValuePersonalizationObject as a basis for your data class.


Constructor Summary
PrefStorePersonalizationManager()
          Null Constructor
 
Method Summary
 void copy(PortletReference from, PortletReference to, ProviderUser user)
          Copies the instance customizations from one reference to another.
 void create(PortletReference ref, PersonalizationObject o, ProviderUser user)
          Creates the initial personalization reference for this (new) PortletReference.
 void create(PortletReference ref, ProviderUser user)
          Creates the initial personalization reference for this (new) PortletReference and establishes its (static) defaults.
 void destroy(PortletReference ref, ProviderUser user)
          Destroys a given Portlet instance from the repository by reference.
 void destroy(ProviderInstance provider, PortletDefinition pd)
          Called to allow the Portlet Personalization manager to destroy its repository.
 boolean exists(PortletReference ref, ProviderUser user)
          Returns true if a customization exists for this given reference.
 void init(PortletDefinition p)
          Initializes the repository for this PrefStorePersonalizationManager.
 void postInitialize()
          Performs any extra steps required to initialize and validate this application object once its child application objects have been created.
 void preInitialize(java.lang.Object parent)
          Performs any steps required to initialize this application object after it has been created, perhaps relating this object to its parent.
 PersonalizationObject read(PortletReference ref, ProviderUser user)
          Returns a data object containing the customizations particular to this reference.
 void validate(java.lang.String context, ValidationError errors)
          Validates the internal state of this PrefStorePersonalizationManager instance.
 void write(PortletReference ref, PersonalizationObject o, ProviderUser user)
          Updates this reference's customization using the passed data object.
 
Methods inherited from class oracle.portal.provider.v2.personalize.PortletPersonalizationManager
getDataClass, setDataClass
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrefStorePersonalizationManager

public PrefStorePersonalizationManager()
                                throws PersonalizationException
Null Constructor

Throws:
PersonalizationException
Method Detail

preInitialize

public void preInitialize(java.lang.Object parent)
                   throws NodeHandlerException
Description copied from interface: InitializableXMLObject
Performs any steps required to initialize this application object after it has been created, perhaps relating this object to its parent.

Specified by:
preInitialize in interface InitializableXMLObject
Parameters:
parent - the application object that will become this object's parent
Throws:
NodeHandlerException - if an error occurs while initializing this application object

postInitialize

public void postInitialize()
                    throws NodeHandlerException
Description copied from interface: InitializableXMLObject
Performs any extra steps required to initialize and validate this application object once its child application objects have been created.

Specified by:
postInitialize in interface InitializableXMLObject
Throws:
NodeHandlerException - if an error occurs while initializing or validating this application object

init

public void init(PortletDefinition p)
Initializes the repository for this PrefStorePersonalizationManager. This method is invoked on each of a Provider's PortletPersonalizationManagers whenever the Provider is registered on a Portal Node (when the Provider's register() method is called). This gives the personalization manager an opportunity to initialize the repository for the corresponding Portlet.

The PrefStorePersonalizationManager currently does nothing in response to this call.

Specified by:
init in class PortletPersonalizationManager
Parameters:
p - the portlet this PrefStorePersonalizationManager is controlling.

destroy

public void destroy(ProviderInstance provider,
                    PortletDefinition pd)
             throws AccessControlException,
                    java.io.IOException
Called to allow the Portlet Personalization manager to destroy its repository. This method is called each time a Provider that manages this PortletPersonalizationManager's Portlet is deregistered (from a portal).

In response to this call, the PrefStorePersonalizationManager uses PreferenceStore.destroy(String,List) to remove all the portlet customization data for this Portlet.

Specified by:
destroy in class PortletPersonalizationManager
Parameters:
pd - definition of the portlet this PortletPersonalizationManager is controlling.
provider - the provider instance that is being deregistered.
Throws:
AccessControlException
java.io.IOException

create

public void create(PortletReference ref,
                   ProviderUser user)
            throws java.io.IOException,
                   PortletAlreadyExistsException,
                   AccessControlException
Creates the initial personalization reference for this (new) PortletReference and establishes its (static) defaults.

In response to this call, the PrefStorePersonalizationManager creates a new instance of the data object class that is registered to it, and calls its init() method to initialize it with the appropriate defaults. Finally, the default data is written to the PreferenceStore to ensure it persists.

Specified by:
create in class PortletPersonalizationManager
Parameters:
ref - the PortletReference. The details of the PortletReference determine whether this creates the default, system instance or a specific user instance.
user - the user attempting this operation. The manager is expected to authorize the user before completing this operation.
Throws:
java.io.IOException
PortletAlreadyExistsException
AccessControlException

create

public void create(PortletReference ref,
                   PersonalizationObject o,
                   ProviderUser user)
            throws PortletAlreadyExistsException,
                   AccessControlException,
                   java.io.IOException
Creates the initial personalization reference for this (new) PortletReference. The initial data object representing this new instance is passed as a parameter.

In response to this call, the PrefStorePersonalizationManager saves the passed object to the PreferenceStore, ensuring the initial data persists.

Specified by:
create in class PortletPersonalizationManager
Parameters:
ref - the PortletReference. The details of the PortletReference determine whether this creates the default, system instance or a specific user instance.
o - the Object representing the initial values for this instance (should implement PersonalizationObject).
user - the user attempting this operation. The manager is expected to authorize the user before completing this operation.
Throws:
PortletAlreadyExistsException
AccessControlException
java.io.IOException

exists

public boolean exists(PortletReference ref,
                      ProviderUser user)
               throws AccessControlException,
                      java.io.IOException
Returns true if a customization exists for this given reference. This will be true if a create() has been previously called.

Specified by:
exists in class PortletPersonalizationManager
Parameters:
ref - the portlet instance to check
user - the user making this request -- passed to give the manager access to the session.
Throws:
AccessControlException
java.io.IOException

read

public PersonalizationObject read(PortletReference ref,
                                  ProviderUser user)
                           throws AccessControlException,
                                  java.io.IOException
Returns a data object containing the customizations particular to this reference. If no customizations exist then the PortletNotFoundException is thrown.

Specified by:
read in class PortletPersonalizationManager
Parameters:
ref - the portlet reference that identifies the instance whose customizations are being requested.
user - the user attempting this operation. The manager is expected to authorize the user before completing this operation.
Returns:
an Object (of the class specified with setDataClass) containing the customizations particular to this reference
Throws:
AccessControlException
java.io.IOException

write

public void write(PortletReference ref,
                  PersonalizationObject o,
                  ProviderUser user)
           throws AccessControlException,
                  java.io.IOException
Updates this reference's customization using the passed data object.

Specified by:
write in class PortletPersonalizationManager
Parameters:
ref - the portlet reference that identifies the instance whose customizations are being updated.
o - the data object containing the new values (should implement PersonalizationObject).
user - the user attempting this operation. The manager is expected to authorize the user before completing this operation.
Throws:
AccessControlException
java.io.IOException

destroy

public void destroy(PortletReference ref,
                    ProviderUser user)
             throws PortletNotFoundException,
                    AccessControlException,
                    java.io.IOException
Destroys a given Portlet instance from the repository by reference. If the reference refers to the system (default) instance the manager should additionally delete all user customizations that correspond.

Specified by:
destroy in class PortletPersonalizationManager
Parameters:
ref - the portlet reference that identifies the instance whose customizations are being deleted.
user - the user attempting this operation. The manager is expected to authorize the user before completing this operation.
Throws:
PortletNotFoundException
AccessControlException
java.io.IOException

copy

public void copy(PortletReference from,
                 PortletReference to,
                 ProviderUser user)
          throws PortletNotFoundException,
                 AccessControlException,
                 java.io.IOException
Copies the instance customizations from one reference to another. If the reference refers to the system (default) instance the manager should additionally copy any other corresponding default customizations for different locales. If the customization for the to reference doesn't exist it is created else the current values are overwritten.

Specified by:
copy in class PortletPersonalizationManager
Parameters:
from - reference for the portlet instance we are copying from.
to - reference for the portlet instance we are copying to.
user - the user attempting this operation. The manager is expected to authorize the user before completing this operation.
Throws:
PortletNotFoundException
AccessControlException
java.io.IOException

validate

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

Specified by:
validate in interface Validateable
Overrides:
validate in class PortletPersonalizationManager
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.