Defines a structure-enum
concept model. A structure-enum
is a specialized type of structure in which each of the properties is an index and the model enumerates all of the possible values. It allows enumerations for properties. You must fulfill the cardinality requirements of all properties to avoid compilation errors. Introducing undeclared properties within constraints also produces errors. For more information, see Modeling Concepts.
You must define this key and its child keys in an *.activity.bxb
file. This file should be located in the appropriate locale-specific resources
folder.
Here is a basic structure-enum
:
// models/concepts/structures/WeightUnit.model.bxb
structure-enum (WeightUnit) {
property (name) {
type (WeightUnitName)
min (Required) max (One)
}
property (abbreviation) {
type (WeightUnitAbbreviation)
min (Required) max (One)
}
constant: WeightUnit {
name: (Milligram)
abbreviation: (mg)
}
constant: WeightUnit {
name: (Centigram)
abbreviation: (cg)
}
...
}
Here is an example of a structure-enum
that has a structure
as a property:
structure-enum (StructureEnum) {
property (name) {
type (Name)
min (Required) max (One)
}
property (structureProperty) {
type (Structure)
min (Required) max (One)
}
constant: StructureEnum {
name: ("this is the name")
structureProperty: Structure {
one: ("this is primitive1")
two: ("this is primitive2")
}
}
}
Here is an example of one of the properties (taskIds
) of the structure-enum
with a max (Many)
cardinality. Notice that you have to individually list each taskIds
item.
structure-enum (Category) {
description (This is my category description)
property (name) {
type (CategoryName)
min (Required) max (One)
}
property (id) {
type (CategoryId)
min (Required) max (One)
}
property (taskIds) {
type (TaskId)
min (Required) max (Many)
}
constant: Category {
name: (category1)
id (12345)
taskIds: (12)
taskIds: (14)
}
}
compile-time-resolved-by optional | Declare an action that can be called to resolve partial instances returned by another action |
constant optional | Allows making properties into an enumeration |
description optional | Adds text describing the structure-enum, which is useful for documenting models |
equivalence optional | A structure equivalence policy joins equivalence constraints together to specify how the system should compare two instances of the same concept |
extends optional | Extends a parent concept with a new child concept, which inherits all of the parent properties |
features optional | Marks a concept with special concept features for user preferences, privacy, or security |
named-consumer optional | Named consumers allow explicitly linking a concept to an action |
natural-order optional | Specifies how to sort instances of the concept |
property optional | Properties define a has-a relationship between concepts |
role-of optional | There are cases where you want to assign a specific role to a feature, but not extend the feature |
sort-orderings optional | Collection of named orderings defined for the structure concept |