C H A P T E R  24

Bean Adapter Model

The Bean Adapter Model allows developers to use one or more JavaBeans as the backing datastore for a model. This allows display fields to be bound to JavaBean properties, and is a convenient approach when you have an application object model and want to leverage automatic binding of these objects to a view. This model is an ideal solution for integrating with an EJB client library. The common and recommended approach when designing a client EJB interface is to use the transfer object pattern where the input, output and return parameters of the EJB business methods are primitive or JavaBeans or collections of the same.

Property Name

Description

Notes

Bean Class

The fully qualified class name of the JavaBean that the model is adapting (based on).

 

Bean Scope

The J2EE scope or location of the bean to be adapted: request, session, application, none or any are the choices. Please note that this model will not originate or create the bean. Existence of the bean in whatever scope is not a responsibility of the base class implementation. The developer may choose none and programmatically assign the adapted bean(s).

 

Bean Scope Attribute Name

The name of the attribute when the scope is set to request, session or application. For example, if the bean is session scoped, this property should be set to the name of the HTTP session attribute.

 

Name

The class name of the component.

Req


Bean Adapter Model Design Actions

Update Fields

Provides for the automatic validation of the Bean Class property and the creation of a model field for each JavaBean property of the Bean Class. This mechanism uses JavaBean introspection to determine the properties. Since the Introspector may cache BeanInfo, repeated invocations of this design action will usually yield the same set of JavaBean properties. If the adapted Bean Class itself changes, then the Studio filesystem for that Bean Class will need to be remounted so that the Bean Introspector will pick up the latest property descriptors.

Fields

Property Name

Description

Notes

Bean Property Name

The name of JavaBean property for this field. Each model field on the Bean Adapter Model represents a single JavaBean property. This property value may be null (not set) if the developer wishes to rely on the model field name property to also represent the name of the JavaBean property. If this property value is set, it must match the exact name of the JavaBean property descriptor name.

 

Name

The logical name of the model field.

Req