Changes to the data model

Changes to data model entity definitions

The following changes were made to the data model definitions:

Element

Change

<column>

  • Added attribute required

<delegate>

  • Added attribute requiresType
  • Added attribute setterScriptability
  • Removed attribute effdatedOnly
  • Removed attribute requires
  • Removed attribute subpackage

<forceindex>

  • Removed attribute db2

<foreignkey>

  • Added attribute archivingOwner
  • Added attribute required
  • Replaced attribute owner with attribute archivingOwner

Note: If the owner attribute is true, set the archivingOwner attribute replacing the owner attribute to source. If the owner attribute is false, set the archivingOwner attribute to target.

<implementsEntity>

  • Removed attribute adapter
  • Attribute impl is no longer required

<nonPersistentEntity>

  • Removed attribute subpackage

<subtype>

  • Removed attribute subpackage

<typekey>

  • Added attribute required

<viewEntity>

  • Added subelement <implementsInterface>
  • Removed attribute subpackage

Entity types can declare required properties

You can now declare required properties for an entity type during object instantiation. To specify that a required entity property is required, set the attribute called required to the value true. The default is false. The required attribute is supported on the <column>, <typekey>, and <foreignkey> definitions of an entity type.

The required attribute does not overlap with the behavior of the existing attribute called nullok. The nullok attribute affects only the value of that property at commit time, which is the time the object is written to the database. In contrast, the required attribute affects only object instantiation. If the required property is an object type, the value must be non-null at the time of object instantiation or else Gosu throws an exception.

Code that uses the new operator to instantiate an entity type must include all required properties when constructing an instance of that entity as arguments to the constructor. If the constructor had other constructor arguments, the required properties appear after the other arguments.

During upgrade, this change may result in compilation errors in expressions that use the new operator to create entities with newly required properties that are omitted. To fix the compilation error, add the required fields after the other arguments.

For example, suppose an entity called MyEntity has one required parameter that is an Address. The code new MyEntity() is now a compilation error because the required property is missing from the argument list. To fix the error, get a reference to a non-null Address entity instance and pass it to the constructor, such as new MyEntity(myAddress).

Some built-in entity types now have required fields. For new entity types, you can add your own custom required properties. However, you cannot add required fields to built-in entity types using data model extensions.

Required bundle arguments

As in previous releases, entity constructors contain an optional parameter that represents the bundle for the new entity instance. The value could be a bundle reference or another entity instance that is already in a writable bundle that you want to use.

If you provide the optional bundle parameter, the constructor argument list must include the bundle parameter before any required properties.

Required fields for product model entities

In PolicyCenter, all Clause, PolicyLine, Exclusion, and PolicyCondition entities now have their pattern code required. However, you cannot directly instantiate those entities nor their subtypes. To directly instantiate these entities with a specific pattern code, you must instantiate related classes in the productmodel package. These product model classes extend the entity types, and they have public constructors that support instantiation and omit the pattern code.

For example, to instantiate the businessowners line, instantiate the type productmodel.BOPLine.

Typecode identifier customization

PolicyCenter changed how typelist codes become Gosu programmatic identifier codes that appear as properties on the typelist type. For example, typecode abc becomes programmatic identifier code TC_ABC.

The typecode definition element <typecode> has a new optional attribute called identifierCode. If you do not set identifierCode, PolicyCenter creates identifier codes using the same algorithm as in 8.0, but does not handle conflicts. If you set identifierCode, PolicyCenter creates the identifier by using the identifierCode. Use identifierCode to resolve identifier name conflicts in a way that is meaningful to you.

See also

Delegate attribute requiresType replaces attribute effdatedOnly

There is a new feature in configuring entity delegates. To declare that the delegate must be implemented by an entity of a general type such as retireable or versionable, add the attribute requiresType on the <delegate> element.

Possible values for the requiresType attribute are the values of the type attribute on the <entity> element. See Data entities and the application database. Some of the general types extend others. For example, editable extends versionable, and versionable extends keyable. An entity can implement the delegate if the implementing entity is the specified type or one that extends it. For example, if the requiresType attribute is keyable, then an implementing entity could have type keyable, versionable, or editable.

For PolicyCenter, the requiresType attribute replaces the effdatedOnly attribute. PolicyCenter upgrades existing data model definition files to convert entities with effdatedOnly set to true to have requiresType set to value effdated.