Enumset (element)

From JRapid

Jump to: navigation, search

enumset is an element.


Contents

Description

Enumsets are global definitions of constant values that can be used in properties of type enum. The enum type is short for "enumerated data". The developer can define a fixed set of words or values that a property of type enum can take as its value.

The enumset element is a global element used to define the values for an enum type property. It may be used by many enum type properties throughout the application.

The privileges attribute, if set, sets the enumset as the enumeration of valid privileges for users. This is used in conjunction with the user stereotype.


Values for enumset elements are defined using the enum element. These elements may specify the value attribute or not. If not, the label is used as the value. Keep in mind that values for enum elements should be valid Java identifiers and that, in order to follow naming best practices, these names should be uppercase.

Usage

<enumset 
        name = NAME
        privileges = PRIVILEGES
        (enum*) 
/>

Example

The Gender enumset can be used in any entity that specifies a gender property of type enum. Ib this case, it is reused in the SalesRepresentative and Customer entities.

    <enumset name="Gender">
        <enum value="M">Male</enum>
        <enum value="F">Female</enum>
    </enumset>

    <entity label="Customer" menu="Menu" name="Customer">
        <property display="primary" label="First Name" name="firstName"/>
        <property display="primary" label="Last Name" name="lastName"/>
        <property enumset="Gender" label="Gender" name="gender" type="enum"/>
    </entity>

    <entity label="Sales Representative" menu="Menu" name="SalesRepresentative">
        <property display="primary" label="First Name" name="firstName"/>
        <property display="primary" label="Last Name" name="lastName"/>
        <property enumset="Gender" label="Gender" name="gender" type="enum"/>
    </entity>


"Gender enumset"

See also

Personal tools