# com.bea.netuix.application.manager
CustomizationContext Class

public class CustomizationContext
extends `Object`
implements `Serializable`

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

Hierarchy
  `Object`
  `CustomizationContext`

All Implemented Interfaces
  `Serializable`

## Field Summary

`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.
`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.
`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.
`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.
`public static final `String`` | `PORTAL_ENTITLEMENT_REQUEST` An http request attribute key name for the EntitlementRequest.

## Constructor Summary

CustomizationContext() A null construtor.
CustomizationContext(`ArrayList` locales, `HttpServletRequest` request) A more complex contructor containing an in order list of preferred locales and a reference to the users dekstop instance id.
CustomizationContext(`ArrayList` locales) A more complex contructor containing an in ordered list of preferred locales.
CustomizationContext(`Locale` locale, `HttpServletRequest` request) Create a minimal customization context consisting of one preferred locale.
CustomizationContext(`Locale` locale) Create a minimal customization context consisting of one preferred locale.
CustomizationContext(`HttpServletRequest` request) Create a minimial customization context consisting of a `HttpServletRequest`.

## Method Summary

`public void` | `addLocale`(`Locale` locale) Add a locale to the end of the preferred locale list.
`public int` | `getDisassemblerTemplateAction`() The action that should be performed if there are collisions between the template and the database dusing disassembly.
`public `Locale`[]` | `getLocales`() Getter for retrieving the ordered list of preferred locales.
`public `EntitlementRequest`` | `getRequest`() Return the EntitlementRequest, this method is used internally and has little use for developers.
`public boolean` | `isVisitorMode`() Is the API being called in visitor mode (default false).
`public void` | `setDisassemblerTemplateAction`(int disassemblerTemplateAction) Set the action that should be performed if there are collisions between the template and the database.
`public void` | `setRequest`(`HttpServletRequest` request) Load the `HttpServletRequest`.
`public void` | `setVisitorMode`(boolean visitorMode) Set how the API is being called.
`public `String`` | `toString`() Dumps the contents of this customization context, little use except for debugging

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Detail

### 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.

### 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 on properties like: backingFile, rolloverImage, activeImage, ...

### 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 tempalte objects take precedence. This option is more commonly used in development as to install new Books and Pages.

### 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. Note: This is the default option.

Related Topics

``DuplicateDefinitionException``

### PORTAL_ENTITLEMENT_REQUEST

    public static final String PORTAL_ENTITLEMENT_REQUEST

  An http request attribute key name for the EntitlementRequest.

Related Topics

``EntitlementRequest``

## Constructor Detail

### CustomizationContext

    public CustomizationContext()

  A null construtor. This constructor can not stand by itself, all methods requesting a customizationContext require a locale and HttpRequest.

### CustomizationContext

    public CustomizationContext(ArrayList locales,
                                HttpServletRequest request)

  A more complex contructor containing an in order list of preferred locales and a reference to the users dekstop instance id. This contructor is usually called by the framework system and not to be used by the average developer.

### CustomizationContext

    public CustomizationContext(ArrayList locales)

  A more complex contructor containing an in ordered list of preferred locales. This contructor is usually called by the framework system and not to be used by the typical developer.

### CustomizationContext

    public CustomizationContext(Locale locale,
                                HttpServletRequest request)

  Create a minimal customization context consisting of one preferred locale. This is the most common constructor used by developers as it contains the required preferred `Locale` and `HttpServletRequest`

### CustomizationContext

    public CustomizationContext(Locale locale)

  Create a minimal customization context consisting of one preferred locale. The locale is used to localize/internationalize each request. Different locales will result in different titles and descriptions being returned for the model objects.

### CustomizationContext

    public CustomizationContext(HttpServletRequest request)

  Create a minimial customization context consisting of a `HttpServletRequest`.

## Method Detail

### addLocale(Locale) Method

    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.

### getDisassemblerTemplateAction() Method

    public int getDisassemblerTemplateAction()

The action that should be performed if there are collisions between the template and the database dusing disassembly.

#### Returns

action Possible values: DISASSEMBLER_ACCEPT_DB, DISASSEMBLER_ACCEPT_TEMPLATE, DISASSEMBLER_PROPAGATE_EXCEPTION, DISASSEMBLER_ACCEPT_DB_UPDATE_MARKUP

### getLocales() Method

    public Locale[] getLocales()

Getter for retrieving the ordered list of preferred locales.

#### Returns

an ordered list of preferred locales. If no Locales are represent a non null zero length array will be returned.

### getRequest() Method

    public EntitlementRequest getRequest()

Return the EntitlementRequest, this method is used internally and has little use for developers.

#### Returns

the entitlement HttpRequest.

### isVisitorMode() Method

    public boolean isVisitorMode()

Is the API being called in visitor mode (default false). The same API namely `PortalCustomizationManager` is used in 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 effect 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

Related Topics

`PortalCustomizationManagerImpl`

### setDisassemblerTemplateAction(int) Method

    public void setDisassemblerTemplateAction(int disassemblerTemplateAction)

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

Possible values:

- CustomizationContext.DISASSEMBLER_ACCEPT_DB
- CustomizationContext.DISASSEMBLER_ACCEPT_TEMPLATE
- CustomizationContext.DISASSEMBLER_PROPAGATE_EXCEPTION
- CustomizationContext.DISASSEMBLER_ACCEPT_DB_UPDATE_MARKUP

Related Topics

``DuplicateDefinitionException``

### setRequest(HttpServletRequest) Method

    public void setRequest(HttpServletRequest request)

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.

### setVisitorMode(boolean) Method

    public void setVisitorMode(boolean visitorMode)

Set how the API is being called. (defaults to false)
The same API namely `PortalCustomizationManager` is used in 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 effect 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.

#### Parameters

visitorMode
  true == only effect the visitor calling this method.

Related Topics

`PortalCustomizationManagerImpl`

### toString() Method

    public String toString()

Dumps the contents of this customization context, little use except for debugging

Overrides
  `Object.toString()`

#### Returns

a debugging string