com.bea.netuix.application.manager
Class CustomizationContext

java.lang.Object
  extended by com.bea.netuix.application.manager.CustomizationContext
All Implemented Interfaces
Serializable

public class CustomizationContext
extends Object
implements Serializable

A client-specific context containing customization properties the database APIs use to personalize the request. Specifically, a preferred Locale is used to internationalize the titles and descriptions and the HttpServletRequest is used to perform entitlement checking on request attributes.

When an object is retrieved from the database with this context, the system will try to find a LocalizationResource, which consists of a title and a description, for the database object. The system will process the locales in the context in order; for each locale, it will determine whether there is a LocalizationResource for the same language as that locale. If so, it will use the LocalizationResource that matches best for that locale. If not, it moves on to the next locale in the context. Finally, the default locale (Locale.getDefault) is checked. If there is still no match, then the behavior depends on the retrieveResultsIfNoLocale value. If this flag is true (the default), then the record will be retrieved with an empty localization resource. Otherwise the record will not be retrieved.

See Also
Serialized Form

Field Summary
static int DISASSEMBLER_ACCEPT_DB
          When disassembling a portal file into a desktop, accept the objects (Books and Pages) in the database if there is a collision with the database object vs the template objects.
static int DISASSEMBLER_ACCEPT_DB_UPDATE_MARKUP
          When disassembling a portal file into a desktop, accept the objects (Books and Pages) in the database if there is a collision with the database object vs the template objects.
static int DISASSEMBLER_ACCEPT_TEMPLATE
          When disassembling a portal file into a desktop, accept the objects (Books & Pages)in the template if there is a collision with the database object vs the template objects.
static int DISASSEMBLER_PROPAGATE_EXCEPTION
          When disassembling a portal file into a desktop, propagate the exception (DuplicateDefinitionException) if there is a collision between the template and the database.
static String PORTAL_ENTITLEMENT_REQUEST
          An http request attribute key name for the EntitlementRequest.
static short PROLIFERATE_ASYNC
          Do not propagate changes to instances asynchronously.
static short PROLIFERATE_IN_PROGRESS
          Internal used to indicate proliferation is in progess
static short PROLIFERATE_OFF
           
static short PROLIFERATE_SYNC
          Do not propagate changes to instances synchronously, as part of the same transaction as the update.
 
Constructor Summary
CustomizationContext(ArrayList locales, javax.servlet.http.HttpServletRequest request)
          Create a CustomizationContext with a list of preferred locales to use in locale matching.
CustomizationContext(ArrayList locales, String webapp)
          Create a CustomizationContext with a list of preferred locales to use in locale matching.
CustomizationContext(Locale locale, javax.servlet.http.HttpServletRequest request)
          

Create a minimal customization context consisting of one preferred locale.

CustomizationContext(Locale locale, String webapp)
          

Create a minimal customization context consisting of one preferred locale.

 
Method Summary
 void addLocale(Locale locale)
          Add a locale to the end of the preferred locale list.
static CustomizationContext clone(CustomizationContext that)
           
 String[] getDaCapabilities()
          Capabilities to check DA against when calling paginated methods.
 int getDisassemblerTemplateAction()
          The action that should be performed if there are collisions between the template and the database during an update.
 Locale[] getLocales()
          Getter for retrieving the ordered list of preferred locales.
 short getProliferationMode()
          Typically all changes that are made to library artifacts are cascaded down to the admin's desktop and subsequently cascaded down to the visitor's view.
 String getResourcePrefix()
          Resource taxonomy prefix of given book/page/portlet instance.
 boolean isRetrieveResultsIfNoLocale()
          This flag applies to methods returning PagedResults only.
 boolean isVisitorMode()
          Is the API being called in visitor mode? The Portal customization API is used in both the Admin Portal as well as the Visitor Tools.
 void setDaCapabilities(String[] daCapabilities)
          Capabilities to check DA against when calling paginated methods.
 void setDisassemblerTemplateAction(int disassemblerTemplateAction)
          Set the action that should be performed if there are collisions between the template and the database.
 void setProliferationMode(short proliferationMode)
          Typically all changes that are made to library artifacts are cascaded down to the admin's desktop and subsequently cascaded down to the visitor's view.
 void setRequest(javax.servlet.http.HttpServletRequest request)
          Load the HttpServletRequest.
 void setRequest(String webapp)
          The EntitlementRequest is created from the webapp name.
 void setResourcePrefix(String resourcePrefix)
          Resource taxonomy prefix of given book/page/portlet instance.
 void setRetrieveResultsIfNoLocale(boolean retrieveResultsIfNoLocale)
          This flag applies to methods returning PagedResults only.
 void setVisitorMode(boolean visitorMode)
          Set whether API call is to be made in visitor or admin mode.
The Portal customization API is used in both the Admin Portal as well as the Visitor Tools.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PORTAL_ENTITLEMENT_REQUEST

public static final String PORTAL_ENTITLEMENT_REQUEST
An http request attribute key name for the EntitlementRequest.

See Also
EntitlementRequest, Constants Summary

DISASSEMBLER_ACCEPT_DB

public static final int DISASSEMBLER_ACCEPT_DB
When disassembling a portal file into a desktop, accept the objects (Books and Pages) in the database if there is a collision with the database object vs the template objects. In other words the database objects take precedence. This option is more commonly used in production as to preserve customizations.

See Also
Constants Summary

DISASSEMBLER_ACCEPT_TEMPLATE

public static final int DISASSEMBLER_ACCEPT_TEMPLATE
When disassembling a portal file into a desktop, accept the objects (Books & Pages)in the template if there is a collision with the database object vs the template objects. In other words the template objects take precedence. This option is more commonly used in development as to install new Books and Pages.

See Also
Constants Summary

DISASSEMBLER_PROPAGATE_EXCEPTION

public static final int DISASSEMBLER_PROPAGATE_EXCEPTION
When disassembling a portal file into a desktop, propagate the exception (DuplicateDefinitionException) if there is a collision between the template and the database. This is the default option.

See Also
DuplicateDefinitionException, Constants Summary

DISASSEMBLER_ACCEPT_DB_UPDATE_MARKUP

public static final int DISASSEMBLER_ACCEPT_DB_UPDATE_MARKUP
When disassembling a portal file into a desktop, accept the objects (Books and Pages) in the database if there is a collision with the database object vs the template objects. However, update the XML (markup) from the .portal file. This will allow for updates for properties that are not mapped to specific database columns, such as properties like backingFile, rolloverImage, activeImage, etc.

See Also
Constants Summary

PROLIFERATE_IN_PROGRESS

public static final short PROLIFERATE_IN_PROGRESS
Internal used to indicate proliferation is in progess

See Also
Constants Summary

PROLIFERATE_OFF

public static final short PROLIFERATE_OFF
See Also
Constants Summary

PROLIFERATE_SYNC

public static final short PROLIFERATE_SYNC
Do not propagate changes to instances synchronously, as part of the same transaction as the update.

See Also
Constants Summary

PROLIFERATE_ASYNC

public static final short PROLIFERATE_ASYNC
Do not propagate changes to instances asynchronously.

See Also
Constants Summary
Constructor Detail

CustomizationContext

public CustomizationContext(Locale locale,
                            javax.servlet.http.HttpServletRequest request)
                     throws com.bea.p13n.entitlements.common.EntitlementsException

Create a minimal customization context consisting of one preferred locale.

Parameters
locale - used to localize titles and descriptions.
request - HttpServletRequest used for entitlements
Throws
com.bea.p13n.entitlements.common.EntitlementsException

CustomizationContext

public CustomizationContext(ArrayList locales,
                            javax.servlet.http.HttpServletRequest request)
                     throws com.bea.p13n.entitlements.common.EntitlementsException
Create a CustomizationContext with a list of preferred locales to use in locale matching.
When an object is retrieved from the database with this context, the system will try to find a LocalizationResource, which consists of a title and a description, for the database object. The system will process the locales in the context in order; for each locale, it will determine whether there is a LocalizationResource for the same language as that locale. If so, it will use the LocalizationResource that best matches for that locale. If not, it moves on to the next locale.

Parameters
locales - list of (Locale) in order of preference.
request - HttpServletRequest
Throws
com.bea.p13n.entitlements.common.EntitlementsException - if an error occurs during creation of an EntitlementRequest.

CustomizationContext

public CustomizationContext(Locale locale,
                            String webapp)

Create a minimal customization context consisting of one preferred locale. This constructor does not require a HttpServletRequest and is the preferred construct when not called from a web app container. It is important to note that this call will not honor request or session expression-based entitlements.

Parameters
locale - used to localize titles and descriptions.
webapp - the name of the webapp this request is scoped to.

CustomizationContext

public CustomizationContext(ArrayList locales,
                            String webapp)
Create a CustomizationContext with a list of preferred locales to use in locale matching.
When an object is retrieved from the database with this context, the system will try to find a LocalizationResource, which consists of a title and a description, for the database object. The system will process the locales in the context in order; for each locale, it will determine whether there is a LocalizationResource for the same language as that locale. If so, it will use the LocalizationResource that best matches for that locale. If not, it moves on to the next locale.
This constructor does not require a HttpServletRequest and is the preferred construct when not called from a web app container. It is important to note that this call will not honor request or session-expression based entitlements.

Parameters
locales - list of (Locale) in order of preference.
webapp - the name of the webapp this request is scoped to.
Method Detail

addLocale

public void addLocale(Locale locale)

Add a locale to the end of the preferred locale list. The locales in this list are used to search against the database to perform a best match.

Parameters
locale - a reference to another preferred locale.

getLocales

public Locale[] getLocales()

Getter for retrieving the ordered list of preferred locales.

Returns
an ordered list of preferred locales. If no Locales are present a zero length array will be returned.

setRequest

public void setRequest(javax.servlet.http.HttpServletRequest request)
                throws com.bea.p13n.entitlements.common.EntitlementsException

Load the HttpServletRequest. An EntitlementRequest is created from this request and put in the HttpServletRequest as an attribute under the key PORTAL_ENTITLEMENT_REQUEST.

Parameters
request - regular HttpServletRequest.
Throws
com.bea.p13n.entitlements.common.EntitlementsException - if an error occurs during creation of an EntitlementRequest.

setRequest

public void setRequest(String webapp)

The EntitlementRequest is created from the webapp name. Only to be used when HttpServletRequest is not available.

Parameters
webapp - the web app name

getDisassemblerTemplateAction

public int getDisassemblerTemplateAction()

The action that should be performed if there are collisions between the template and the database during an update.

Returns
action Possible values: DISASSEMBLER_ACCEPT_DB, DISASSEMBLER_ACCEPT_TEMPLATE, DISASSEMBLER_PROPAGATE_EXCEPTION, DISASSEMBLER_ACCEPT_DB_UPDATE_MARKUP

setDisassemblerTemplateAction

public void setDisassemblerTemplateAction(int disassemblerTemplateAction)

Set the action that should be performed if there are collisions between the template and the database.

Possible values:

Parameters
disassemblerTemplateAction -
Throws
IllegalArgumentException - if disassemblerTemplateAction is not one of the three valid values.
See Also
DuplicateDefinitionException

isVisitorMode

public boolean isVisitorMode()

Is the API being called in visitor mode? The Portal customization API is used in both the Admin Portal as well as the Visitor Tools. The flag indicates at what level you what to customize. If this flag is set to false (default) then the changes made through the API affect the admin instance as well as all user instances, so all users will see the change. If this flag is set to true then only the user calling it will see the changes.

Returns
visitor mode
See Also
com.bea.netuix.application.manager.persistence.jdbc.PortalCustomizationManagerImpl

setVisitorMode

public void setVisitorMode(boolean visitorMode)

Set whether API call is to be made in visitor or admin mode.
The Portal customization API is used in both the Admin Portal as well as the Visitor Tools. The flag indicates at what level you what to customize. If this flag is set to false (default) then the changes made through the API affect the admin instance as well as all user instances, so all users will see the change. If this flag is set to true then only the user calling it will see the changes.
Note: you need to be in an ADMIN role in order to set visitor mode == false. Otherwise any user could affect the entire portal.

Parameters
visitorMode - if true, only affect the visitor calling this method.
See Also
com.bea.netuix.application.manager.persistence.jdbc.PortalCustomizationManagerImpl

isRetrieveResultsIfNoLocale

public boolean isRetrieveResultsIfNoLocale()
This flag applies to methods returning PagedResults only. If true, the returned PagedResult only contains objects with at least one localization resources with the same language as one of the locales in this context object. The default is true.


setRetrieveResultsIfNoLocale

public void setRetrieveResultsIfNoLocale(boolean retrieveResultsIfNoLocale)
This flag applies to methods returning PagedResults only. If true, the returned PagedResult only contains objects with at least one localization resources with the same language as one of the locales in this context object. The default is true.


getDaCapabilities

public String[] getDaCapabilities()
Capabilities to check DA against when calling paginated methods. The system will grant access if access is allowed for at least one of these capabilities.


setDaCapabilities

public void setDaCapabilities(String[] daCapabilities)
Capabilities to check DA against when calling paginated methods. The system will grant access if access is allowed for at least one of these capabilities.


getResourcePrefix

public String getResourcePrefix()
Resource taxonomy prefix of given book/page/portlet instance.


setResourcePrefix

public void setResourcePrefix(String resourcePrefix)
Resource taxonomy prefix of given book/page/portlet instance.


getProliferationMode

public short getProliferationMode()

Typically all changes that are made to library artifacts are cascaded down to the admin's desktop and subsequently cascaded down to the visitor's view. If this property is set to "SYNC" then these changes will occur synchronously as part of this transaction. If this property is set to "ASYNC" then changes will be queued on a persistent JMS queue and each user's proliferation will occur in its own separate transaction in the background. If this property is set to "OFF" then changes will not get cascaded for the artifacts which have been modified. (NOTE: For books, pages and portlets that have not been modified at the admin or visitor level, then these will always receive the changes as they point to the default).

Returns
proliferationMode Possible values:
  • CustomizationContext.PROLIFERATE_OFF
  • CustomizationContext.PROLIFERATE_SYNC
  • CustomizationContext.PROLIFERATE_ASYNC

setProliferationMode

public void setProliferationMode(short proliferationMode)

Typically all changes that are made to library artifacts are cascaded down to the admin's desktop and subsequently cascaded down to the visitor's view. If this property is set to "SYNC" then these changes will occur synchronously as part of this transaction. If this property is set to "ASYNC" then changes will be queued on a persistent JMS queue and each user's proliferation will occur in its own separate transaction in the background. If this property is set to "OFF" then changes will not get cascaded for the artifacts which have been modified. (NOTE: For books, pages and portlets that have not been modified at the admin or visitor level, then these will always receive the changes as they point to the default).

Parameters
proliferationMode - Possible values:
  • CustomizationContext.PROLIFERATE_OFF
  • CustomizationContext.PROLIFERATE_SYNC
  • CustomizationContext.PROLIFERATE_ASYNC

clone

public static CustomizationContext clone(CustomizationContext that)


Copyright © 2011, Oracle. All rights reserved.