Documentation Archive Developer
Search
PATH  Documentation > WebObjects 4.5 > EOF Tools and Techniques

Table of Contents Previous Section

Prototype Attributes

To allow easier model creation from scratch, EOModeler supports the concept of prototype attributes. Prototype attributes are just what they sound like - special attributes from which other attributes derive their settings. A prototype can specify any of the characteristics you normally define for an attribute. When you create an attribute, you can associate it with one of these prototypes, and the attribute's characteristics are then set from the prototype definition.

For example, suppose your adaptor contains a date prototype that defines the value class to be NSGregorianDate (NSCalendarDate in Objective-C) and the external type to be DATE. When you create an attribute and associate it with this date prototype, the attribute's value class is dynamically resolved to NSGregorianDate and its external type is dynamically resolved to DATE.

Assigning a Prototype to an Attribute

To associate an attribute with a prototype, use the table mode of the Model Editor. Simply choose a prototype from the combo box in the Prototype column as shown in Figure 22. If EOModeler isn't displaying the Prototype column, activate it from the Add Column menu.

Figure 22. Assigning a Prototype to an Attribute

If any of the prototype information is incorrect for your attribute, you can override it. Just set the property of the attribute to the value you want (see Figure 23). The remaining attribute properties will still dynamically resolve to the values set in the prototype.

Figure 23. Overriding Prototype Settings

Creating Prototype Attributes

The prototypes you can assign to an attribute come from three places:

  1. An entity named EO<AdaptorName>Prototypes, where <AdaptorName> is the name of the adaptor for your model (EOOraclePrototypes, for example)

  2. An entity named EOPrototypes

  3. The adaptor for your model
So to create your own prototype, create a prototype entity-an entity named either EO<AdaptorName>Prototypes or EOPrototypes-and add an attribute to it. Note that the EO<AdaptorName>Prototypes and EOPrototypes entities can be defined in the current model or in another model in the model group (all the models in your project are typically a part of the same model group).

When resolving a prototype name, Enterprise Objects Framework looks for prototypes in EO<AdaptorName>Prototypes, then in EOPrototypes, and finally in the adaptor for your model. This search path allows you to override the prototypes provided by each adaptor. Furthermore, if you don't want to use the adaptor-defined prototypes at all, you can hide them. Create an entity named EOPrototypesToHide. For each prototype you want to hide, create an attribute with that name; you don't need to specify other attribute properties.

Table of Contents Next Section