Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2008 BEA Systems, Inc. All Rights Reserved
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.netuix.servlets.attributes
Interface PortalAttributes

    public interface PortalAttributes

This is an interface for attaching arbitrary data to portal elements. Attributes can be set in two ways: via the API described below, or in a .portal/.portlet file. To set an attribute in a file, use the <portalAttribute> element. Here is an example `<netuix:book ... > <netuix:portalAttribute name="myKey" value="show me" scope="request" /> ... </netuix:book>` This snippet attaches a request-scoped attribute with name="myKey" to the given book. The value of the attribute can be retrieved by calling the `getAttribute` method as described below. These values specified in the .portal file are used as defaults for each new request, session, or web application, depending on the scope specified. They can be overridden for the life of the request/session using the `setAttribute` method. Use the Factory class to get PortalAttributes instances from a backing or presentation context.

Nested Class Summary
`static class` | `PortalAttributes.Factory`
`static class` | `PortalAttributes.Scope` This defines the scope of an attribute.

Method Summary
`Object` | `getAttribute(String key, PortalAttributes.Scope scope)` Retrieve the given attribute for the given key, at the given scope level.
`int` | `getAttributeAsInt(String key, PortalAttributes.Scope scope)` Same behavior as `getAttribute`, but the result is coerced into an int value.
`Collection<String>` | `getAttributeNames(PortalAttributes.Scope scope)` Return a collection consisting of all the names of attributes for a certain portal element at a certain scope.
`void` | `removeAttribute(String key, PortalAttributes.Scope scope)` Clear the attribute value for a given key at a given scope.
`void` | `setAttribute(String key, int value, PortalAttributes.Scope scope)` Set an integer attribute value for a given key at a given scope.
`void` | `setAttribute(String key, Object value, PortalAttributes.Scope scope)` Set the attribute value for a given key at a given scope.

Method Detail

### getAttribute

    Object getAttribute(String key,
                        PortalAttributes.Scope scope)

  Retrieve the given attribute for the given key, at the given scope level. When this method is called, the system will use the portal element element that is currently being processed in the given request. This essentially means that this method should be called from a portal backing file in a backing processing phase, or from a jsp in the portal render phase. The method returns null if there is no attribute for the given key at the given scope.

### getAttributeAsInt

    int getAttributeAsInt(String key,
                          PortalAttributes.Scope scope)
                          throws NumberFormatException

  Same behavior as `getAttribute`, but the result is coerced into an int value.

  Throws
    `NumberFormatException`

### setAttribute

    void setAttribute(String key,
                      Object value,
                      PortalAttributes.Scope scope)

  Set the attribute value for a given key at a given scope. This replaces any existing attribute.

### setAttribute

    void setAttribute(String key,
                      int value,
                      PortalAttributes.Scope scope)

  Set an integer attribute value for a given key at a given scope. This replaces any existing attribute.

### removeAttribute

    void removeAttribute(String key,
                         PortalAttributes.Scope scope)

  Clear the attribute value for a given key at a given scope.

### getAttributeNames

    Collection<String> getAttributeNames(PortalAttributes.Scope scope)

  Return a collection consisting of all the names of attributes for a certain portal element at a certain scope.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008 BEA Systems, Inc. All Rights Reserved