<viewEntity> elements and related data object types

The <viewEntity> XML root element defines view entity data object types. A view entity data object type is a logical view of entity data. You can use a view entity to enhance performance during the viewing of tabular data. A view entity provides a logical view of data for an entity of interest to a list view. A view entity can include paths from the root or primary entity to other related entities.

For example, from the DesktopActivityView, you can specify a column with a Job.JobNumber value. The Activity entity is the primary entity of the DesktopActivityView. The Activity entity has a corresponding view entity called ActivityView.

Unlike a standard entity, a view entity does not have an underlying database table. PolicyCenter does not persist view entities to the database. Instead of storing data, a view entity restricts the amount of data that a database query returns. A view entity does not represent or create a materialized view, which is a database table that caches the results of a database query.

Queries against a view entity type are actually run against the normal entity table in the database, as specified by the primaryEntity attribute of the view entity definition. The query against a view entity automatically adds any joins necessary to retrieve view entity columns if they include a bean path. However, access to view entity columns is not possible when constructing the query.

A view entity improves the performance of PolicyCenter on frequently used pages that list entities. Like other entities, you can subtype a view entity.

For example, the My Activities page uses a view entity, the ActivityDesktopView, which is a subtype of the ActivityView.

Because PolicyCenter can export view entity types, it generates SOAP interfaces for them.

Note: If you create or extend a view entity that references a column that is of type="currencyamount", then you must handle the view entity extension in a particular manner. See Extending an existing view entity with a currency column for details.

Guidewire defines view entities in the data model metadata files.

Attributes of <viewEntity>

The <viewEntity> element contains the following attributes:

<viewEntity>  attribute        

Description

Default

abstract

If true, you cannot an create 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 entity.

None

displayName

Optional. Creates a more human-readable form of the entity name. You can access this name using the following:

viewEntity.displayName

If you do not specify a value for the displayName attribute, then the entity.displayName method returns the value of the entity attribute, instead. If you subtype an entity that has a specified display name, then the entity.displayName method returns the name of the subtype key.

None

entity

Required. Name of this viewEntity object.

None

exportable

Unused.

extendable

If true, it is possible to extend this entity.

true

final

If true, the entity definition is final and you cannot define any subtypes for it. If false, then you can define a subtype using this entity as the supertype.

true

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

primaryEntity

Required. The primary entity type for this viewEntity object. The primary entity must be keyable. See Data entities and the application database for information on keyable entities.

None

priority

For supertypes and subtypes, the priority of the corresponding subtype key.

-1

showRetiredBeans

Whether to show retired beans in the view.

None

supertypeEntity

Optional. The name of supertype of this entity.

None

typelistTableName

If you create a non-final entity, then PolicyCenter automatically creates a typelist to keep track of the subtypes of that entity. That typelist has an associated database table. If you do not specify a value for this attribute, then PolicyCenter uses the name of the entity as the table name for the subtype typelist.

However, PolicyCenter places a restriction of 25 characters on the length of the database table name. You use this attribute to specify an alternate database table name for the typelist if an entity name is too long to become a valid typelist table name.

It is not valid to use this attribute with entity types marked as final.

None

Subelements of <viewEntity>

The <viewEntity> elements contain the following subelements:

<viewEntity>  subelement   

Description

computedcolumn

Specifies a column with row values that Guidewire computes while querying the database. For example, the values of a computed column might be the sum of the values from two database columns (col1 + col2).

computedtypekey

Specifies a typekey that has some type of transformation applied to it during querying from the database.

fulldescription

See the discussion following the table.

implementsInterface

See <implementsInterface>.

viewEntityColumn

Represents a column in a viewEntity table.

viewEntityLink

Uses to access another entity through a foreign key. Typically, you use this value within the PolicyCenter interface to create a link to that entity.

viewEntityName

Represents an entity name column in a viewEntity table. An entity name is a string column that contains the name of an entity that is suitable for viewing in the PolicyCenter interface.

viewEntityTypekey

Represents a typekey column in a viewEntity table.

The Data Dictionary uses the fulldescription subelement. The following example illustrates how to use this element:

<fulldescription>
  <![CDATA[<p>Aggregates the information needed to display one activity row (base entity for all other
           activity views).</p>]]>
</fulldescription>

The other subelements all require both a name and path attribute. The following code illustrates this:

<viewEntityName name="RelActAssignedUserName" path="RelatedActivity.AssignedUser"/>

Specify the path value relative to the primaryEntity on which you base the view.

The computedcolumn takes a required expression attribute and an additional, optional function attribute. The following is an example of a computedcolumn:

<computedcolumn name="Amount" expression="${1}" paths="LineItems.Amount" function="SUM"/>

The expression for this column can take multiple column values ${column_num} passed from the PolicyCenter interface. For example, a valid expression is ${1} - ${2}, where ${1} represents the first column and ${2} represents the second column. The function value must be an SQL function that you can apply to this expression. The following are legal values:

  • SUM
  • AVG
  • COUNT
  • MIN
  • MAX
Note: If the SQL function aggregates data, PolicyCenter applies an SQL group automatically.