<subtype> elements and related data object types

The <subtype> XML root element defines an entity type that is a subtype of another entity. The subtype entity has all of the fields and elements of its supertype. The subtype entity can also have additional fields and elements. Guidewire defines subtype entities in the data model metadata files.

PolicyCenter does not associate a separate database table with a subtype. Instead, PolicyCenter stores all subtypes of a supertype in the table of the supertype and resolves the entity to the correct subtype based on the value of the Subtype field. To accommodate this, PolicyCenter stores all fields of a subtype in the database as nullable columns—even the ones defined as non-nullable. However, if you define a field as non-nullable, then the PolicyCenter metadata service enforces this for all data operations.

You can only define a subtype for any entity that has its final attribute set to false. PolicyCenter automatically creates a Subtype field for non-final entities.

Attributes of <subtype>

The <subtype> element contains the following attributes:

<subtype>  attribute           

Description

Default

abstract

If true, you cannot create an instance of the entity type at runtime. Instead, you must declare a subtype entity with abstract=false, which you can instantiate. Any of the generated code is abstract.

false

desc

A description of the purpose and use of the subtype.

None

displayName

Optional. Occasionally in the PolicyCenter interface, you want to display the subtype name of subtyped entity instances. Use the displayName attribute to specify a String to display as the subtype name. You can access this name using the following:

entity.DisplayName

If you do not specify a value for the displayName attribute, then PolicyCenter displays the name of the entity. The entity name is often not user-friendly. For a description of the displayName attribute, see <entity> elements and related data object types.

None

entity

Required. This attribute has a maximum length of 50.

final

If true, you cannot subtype the entity. If false, you can define subtypes using this entity as the supertype.

false

platform

Internal. Do not use. The only real effect is to change the location in which the table appears in a data distribution report.

false

priority

The priority of the corresponding subtype key. This value is meaningful only for entities participating in a subtype hierarchy, which can be either the <subtype> entities or the root <entity>.

-1

readOnly

Optional. The typical use of read-only entities is for tables of reference data that you import as administrative data and then never touch again.

You can add a read-only entity only to a bundle that has the allowReadOnlyBeanChanges() flag set on its commit options. That means that inserting, modifying or deleting a read-only entity requires one of these special bundles.

You cannot set bundle commit options from Gosu. Therefore, you cannot modify these entities from Gosu, unless some Gosu-accessible interface gives you a special bundle. The administrative XML import tools use such a special bundle. However, Guidewire uses these tools internally only in the PolicyCenter product model.

None

setterScriptability

See Data objects and scriptability for information.

None

supertype

Required.

Subelements of <subtype>

The <subtype> element contains the following subelements.

<subtype>  subelement      

Description

array

See <array>.

checkconstraint

Internal.

column

See <column>.

customconsistencycheck

Internal.

datetimeordering

Internal.

dbcheckbuilder

Internal.

edgeForeignKey

See <edgeForeignKey>.

events

See <events>.

foreignkey

See <foreignkey>.

fulldescription

See <fulldescription>.

implementsEntity

See <implementsEntity>.

implementsInterface

See <implementsInterface>.

index

See <index>.

jointableconsistencycheck

Internal.

monetaryamount

Handles monetary amounts. The <monetaryamount> subelement is a compound data type that stores its values in two separate database columns: a <money> column type, and a typekey to the Currency typelist.

onetoone

See <onetoone>.

searchColumn

See <entity> elements and related data object types.

searchTypekey

Defines a search denormalization typekey in the database. The denormalization copies the value of a column on another table into a typekey field on the denormalizing table. You must link the tables through a foreign key. The purpose of this denormalization is to avoid costly joins in performance critical searches.

tableAugmenter

Internal.

typekey

See <typekey>.

validatetypekeyinset

Internal.

validatetypekeynotinset

Internal.

Subtypes and typelists

After you define a new subtype, PolicyCenter automatically adds that entity type to the associated entity typelist. This is true, even if PolicyCenter marks that typelist as final.

For example, suppose that you define an Inspector entity as a subtype of Person.

<?xml version="1.0"?>
<subtype xmlns="http://guidewire.com/datamodel" desc="Professional inspector" displayName="Inspector"
        entity="InspectorExt"
        supertype="Person">
  <column name="InspectorLicenseExt" type="varchar" desc="Inspector's business license number">
    <columnParam name="size" value="30"/>
  </column>
</subtype>

Notice that while InspectorExt is subtype of Person, Person, itself, is a subtype of Contact. PolicyCenter automatically adds the new InspectorExt type to the Contact typelist. This is true, even though PolicyCenter marks the Contact typelist as final.

To see this change:

  • In the PolicyCenter Data Dictionary, you must restart the application server.
  • In the Contact typelist in Studio, you must restart Studio.

See also