Extending an existing view entity
Guidewire uses viewEntity entities to improve
performance for list view pages in rendering the PolicyCenter interface. (See <viewEntity> elements and related data object types for details.) Some default
PCF pages make use of list view entities and some do not. If you add
a new field to an entity, then you need to decide if you want to extend
a viewEntity to include
this new field. This can potentially avoid performance degradation.
The following example illustrates a case
in which you add an extension both to a primary entity and its corresponding
viewEntity. First search
for Activity.etx to determine
if one exists. (Use Ctrl+N to open the search dialog.)
Add the following to Activity.etx:
<extension entityName="Activity">
...
<column type="bit"
name="validExt"
default="true"
nullok="true"
desc="Sample bit extension, with a default value."/>
...
</extension>
Next, search for ActivityDesktopView.etx. Suppose that you do not find this file, but you see that ActivityDesktopView.eti exists. As this is part of the base configuration, you cannot modify this declaration file. However, find the highlighted file in Guidewire Studio™ and select from the right-click submenu. This opens a mostly blank file.
Enter the following in ActivityDesktopView.etx:
<viewEntityExtension entityName="ActivityDesktopView">
<viewEntityColumn name="validExt" path="validExt"/>
</viewEntityExtension>
path
attribute is always relative to the primary entity on which you base
the view.These data model changes add a validExt column (field) to the
Activity object, which
is also accessible from the ActivityDesktopView
entity.
Extending an existing view entity with a compound data type
If you create or extend a view entity with a column that references a compound data type, you must handle the view entity extension in a particular manner. If the view entity extension column references a compound data type, then you need to append the appropriate suffix on the path for the column. This suffix represents the relevant data for the compound data type.
For example, suppose that in PolicyCenter, you extend the
PolicyPeriodSummary view entity. In doing so, you wish to add a field from
the PolicyPeriod entity, TotalPremiumRPT. Looking at the
definition of PolicyPeriod, you see the following:
<monetaryamount
amountColumnName="TotalPremiumRPT" desc="Total amount of all premium (but not taxes or any other costs)
for the entire policy period. The total is denormalized for higher performance UI display and
reporting support."
name="TotalPremiumRPT"
nullok="true"/>Notice that PolicyPeriod.TotalPremiumRPT is a
monetaryamount element. As a consequence, if you extend
PolicyPeriodSummary with this field, you need to define a column for the
field with a particular suffix on the path attribute. Add the following
to PolicyPeriodSummary.etx:
<viewEntityColumn name="TotalPremiumRPT" path="TotalPremiumRPT_amt"/>By defining a TotalPremiumRPT column on the view entity, the view entity loads
the total reported premium.
The complete extension of the PolicyPeriodSummary view entity will also have
a currency type for the TotalPremiumRPT column. Adding this currency type
requires a type key. The name and path for the type key must have the respective suffixes
Cur and _cur. The complete extension of the
PolicyPeriodSummary view entity is as follows:
<viewEntityExtension xmlns="http://guidewire.com/datamodel" entityName="PolicyPeriodSummary">
<viewEntityColumn name="TotalPremiumRPT" path="TotalPremiumRPT_amt"/>
<viewEntityTypekey name="TotalPremiumRPTCur" path="TotalPremiumRPT_cur"/>
</viewEntityExtension>
