Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 37

Subtypes

December 9, 2013

© Guidewire Software, Inc. 2001-2013. All rights reserved.


Do not distribute without permission.
Lesson objectives
• By the end of this lesson, you should be able to:
- Describe the role of subtypes and supertypes in the data
model
- Extend an existing subtype entity
- Create new a subtype entity
- Create a subtype extension

This lesson uses the notes section for additional explanation and information.
To view the notes in PowerPoint, select View  Normal or View  Notes Page.
When printing notes, select Note Pages and Print hidden slides.
© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 2
Lesson outline

• Subtype basics

• Create a subtype entity extension

• Create a subtype entity

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 3
Subtype entity
• A subtype is an entity that ABContact
is a child to a supertype
entity and inherits all fields …
from the supertype PrefersContactByEmail
...
• Example:
- ABContact is the supertype
- ABCompany is the subtype
- ABCompany inherits ABCompany
PrefersContactByEmail
from ABContact …
CanAddEmployees
- ABContact does NOT

inherit CanAddEmployees

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 4
Subtype hierarchy
primary ABContact

entity
primary
subtypes ABPerson ABCompany ABPlace

ABAdjudicator ABPersonVendor ABPolicyPerson ABPLegalVenue

ABCompanyVendor ABPolicyCompany

ABAttorney ABDoctor

ABLawFirm ABAutoTowingAgcy ABAutoRepairShop

ABAutoScrapYard_Ext ABMedicalCareOrg

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 5
Additional parent and subtype examples
• All applications
- Contact: Person, Company, Place, ...

• ClaimCenter
- Incident: InjuryIncident, TripIncident, PropertyIncident
- Transaction: Payment, Recovery, Reserve, ...

• PolicyCenter
- Job: Submission, Renewal, Cancellation, Reinstatement, ...
- PlanDetail: BillingPlanDetail, PaymentPlanDetail, ...

• BillingCenter
- Plan: BillingPlan, CommissionPlan, DelinquencyPlan, ...
- ChargePattern: ImmediateCharge, ProRataCharge, ...

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 6
Entity Editor shows subtypes
• Element reads as subtype or subtype (extension)
- In XML, it is the <subtype/> or <extension />

• Attribute pane details supertype entity

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 7
Entity editor toolbar open file navigation
• Open file navigation menu details ABContact

subtype position in hierarchy


• Navigate up to parent supertypes
ABPerson

ABPersonVendor

• Navigate down
to children
subtypes
ABAttorney ABDoctor

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 8
Subtypes in the database
• Typelist and entity database tables define
supertypes and subtype relationship
- ABContact has 18 subtypes
• Supertype entity table contains all
subtype columns in denomarlized form
- Irrelevant columns for subtype are NULL
- ID, Name, TaxID from ABContact
- FirstName, LastName from ABPerson
- AttorneyLicense from ABAttorney
- IsFranchise is from ABAutoRepairShop

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 9
Subtypes in the data dictionary
• Parent entity

• List of
subtypes

• Fields at
parent level

• Fields at
subtype level

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 10
Subtypes and Gosu classes
configuration application server
ABContact
ABContact
… Fields
PrefersContactByEmail …
...
PrefersContactByEmail
eti …

ABCompany ABCompany
… Fields
CanAddEmployees …
… PrefersContactByEmail
eti
CanAddEmployees
...
ab_abcontact
table row
database

anABCompany
Coverage read from database instance
of Gosu
class
save to database
© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 11
Subtype limitations
• New subtypes inherit from supertype
- All elements and attribute defaults
- Behavior of its supertype
- Only single inheritance ABContact

• Unable to inherit from


multiple supertypes
- Can a towing agency repair cars? ABCompany

No.
- Can an auto repair shop tow cars?
No. ABCompanyVendor
- Can you create a single contact
that both repairs and tows cars?
Yes, but you will need to create
a new subtype
with duplicate fields! ABAutoTowingAgcy ABAutoRepairShop

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 12
Lesson outline

• Subtype basics

• Create a subtype entity extension

• Create a subtype entity

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 13
Steps to create a subtype extension
1. Navigate to the subtype entity
2. Create an entity extension file
3. Add elements (and subelements) and specify attribute
values
4. Optionally regenerate the dictionary
5. Deploy the subtype extension entity

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 14
Step 1: Navigate to the subtype entity (1)

• Navigate to an entity in …\Metadata\Entity\


- Project View or using CTRL+N

• Studio will open an existing extension first


- If an existing extension already exists, STOP
- Do NOT create a new extension; edit existing extension instead!

• Verify that you have selected an entity file (ETI)


- Not EIX or ETX
© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 15
Step 1: Navigate to the subtype entity (2)
• View in Entity Editor or Xml Viewer
• Entity (ETI) file must be a subtype entity
- <subtype /> element
- supertype = entity attribute name value
- final = false attribute name value

<subtype … entity="ABPersonVendor" final="false" supertype="ABPerson">

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 16
Step 2: Create an entity extension file (1)
• Project View  Context menu  New  Entity Extension
• Do NOT enter filename suffix; Click OK

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 17
Step 2: Create an entity extension file (2)

• Unable to click OK? Click Cancel


- Grayed out path shows that an entity extension (ETX) file already
exists!
• Navigate to the
entity (CTRL+N)
- Studio automatically
opens the extension file first!
- Edit the extension in the Entity Editor
© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 18
Step 2: Create an entity extension file (3)
• For an entity (ETI) in …\Extensions\Entity\
- NOT possible to create
entity extension (ETX)
- Edit the ETI file directly
in the Entity Editor

• For an entity extension (ETX) in …\Extensions\Entity


- Do NOT create an
extension for an extension
- Click Cancel
- Edit the ETX file directly
in the Entity Editor

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 19
Step 3: Add elements and specify attributes
• Toolbar • Context menu
- Select option in dropdown - Add new…
- Click + to add more of - Select option in menu
same

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 20
Common elements to add
• Common elements for:
- Entity extension, entity, subtype, subtype extension

• <array …/>
- Define array entity and field

• <column …/>
- Define data field with defined data type
- Bit, datetime, integer, varchar

• <foreignkey …/>
- Define foreign key field and entity

• <typekey …/>
- Define typekey and related typelist

• Create entity extension field names ending with _Ext

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 21
Validate the schema
• Click Validate in the toolbar

• Red highlight indicates schema violation warning


• Schema violations explained in pane below editor

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 22
Step 4: Optionally regenerate dictionary
• gwXX regen-dictionary
• Process builds entire entity model including base and
custom entities
• Identifies errors in the data model beyond Entity Editor
schema validation

C:\Guidewire\TrainingApp\bin>gwta regen-dictionary
regen-entity-model-xml:
====================================================
= Running main class:
com.guidewire.tools.dictionary.data.EntityModelXmlTool
[java] --- Guidewire Entity Model In Xml ---

ERROR Errors found in ABPersonVendor
ERROR NoTwoColumnsWithTheSameName - Duplicate property
"SelfEmployeed_Ext" found for entity "ABPersonVendor"

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 23
Step 5: Deploy the subtype entity extension
Restart Server • bin command window
- gwXX dev-stop
• Entity Extension - gwXX dev-start
• Or, Guidewire Studio
- Run  Stop
- Run 'Server' or Debug
'Server'
• During start-up
- If autoupgrade=true in
etx database-config.xml, then
Guidewire attempts to
upgrade the database
Entity Extension according to the changes in
the data model
© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 24
Lesson outline

• Subtype basics

• Create a subtype entity extension

• Create a subtype entity

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 25
Steps to create a new subtype
1. Create the subtype entity file
2. Add elements and specify attributes
3. Optionally regenerate the dictionary
4. Deploy the subtype entity

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 26
Step 1: Create the subtype entity (1)

• In Project View, select


.../config/Extensions/Entity
- Context menu  New  Entity

• Entity dialog
- 22 character max length
- Use CamelCase ending with _Ext
- Example: ABPropInspector_Ext
- (continued)

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 27
Step 1: Create the subtype entity (2)
• For Entity Type, select subtype
- Fields change in Entity dialog

• Select supertype
- In Supertype field,
click ellipse (…)
to open the
Supertype dialog
- In dialog,
select the
parent entity

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 28
Step 2: Add elements and specify attributes
• Toolbar • Context menu
- Select option in dropdown - Add new…
- Click + to add more of - Select option in menu
same

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 29
Common elements to add
• Common elements for:
- Entity extension, entity, subtype, subtype extension

• <array …/>
- Define array entity and field

• <column …/>
- Define data field with defined data type
- Bit, datetime, integer, varchar

• <foreignkey …/>
- Define foreign key field and entity

• <typekey …/>
- Define typekey and related typelist

• Do NOT create entity field names ending with _Ext

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 30
Entity editor: Attribute pane
• Name Value columns
- For selected element,
define attributes
• Schema aware values
- Boolean controls
- Dropdown lists

• Attribute styling
- Bold for required
- Black for editable
- Grayed-out for non-editable
- Overridden, Inherited,
Internal, Default
• Nullok defaults to false!
- Set to true in most cases

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 31
Validate the schema
• Click Validate in the toolbar

• Red highlight indicates schema violation warning


• Schema violations explained in pane below editor

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 32
Step 3: Optionally regenerate dictionary
• gwXX regen-dictionary
• Process builds entire entity model including base and
custom entities
• Identifies errors in the data model beyond Entity Editor
schema validation

C:\Guidewire\TrainingApp\bin>gwta regen-dictionary
regen-entity-model-xml:
====================================================
= Running main class:
com.guidewire.tools.dictionary.data.EntityModelXmlTool
[java] --- Guidewire Entity Model In Xml ---

ERROR Errors found in ABAutoScrapYard_Ext
ERROR NoTwoColumnsWithTheSameName - Duplicate property
"CanPickUpVehicles" found for entity "ABAutoScrapYard_Ext"

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 33
Step 4: Deploy the subtype entity
Restart Server • bin command window
- gwXX dev-stop
• Entity - gwXX dev-start
• Or, Guidewire Studio
- Run  Stop
- Run 'Server' or Debug
'Server'
• During start-up
- If autoupgrade=true in
eti database-config.xml, then
Guidewire attempts to
upgrade the database
Entity according to the changes in
the data model
© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 34
Lesson objectives review
• You should now be able to:
- Describe the role of subtypes and supertypes in the data model
- Extend an existing subtype entity
- Create new a subtype entity
- Create a subtype extension

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 35
Review questions
1. What is a subtype entity? What is the XML element for a
subtype entity?
2. What is a subtype entity extension? What is the XML
element for a subtype entity extension?
3. Describe at least one limitation of relying heavily on
subtype hierarchies.
4. When you create a new subtype, why are you NOT able
specify a table name?
5. If creating a subtype extension and the path to the
extension is grayed out and you are unable to click OK,
what should you do?

© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 36
Notices
Copyright © 2001-2013 Guidewire Software, Inc. All rights reserved.

Guidewire, Guidewire Software, Guidewire ClaimCenter, Guidewire PolicyCenter,


Guidewire BillingCenter, Guidewire Reinsurance Management, Guidewire
ContactManager, Guidewire Vendor Data Management, Guidewire Client Data
Management, Guidewire Rating Management, Guidewire InsuranceSuite, Guidewire
ContactCenter, Guidewire Studio, Guidewire Product Designer, Guidewire Live, Guidewire
ExampleCenter, Gosu, Deliver Insurance Your Way, and the Guidewire logo are
trademarks, service marks, or registered trademarks of Guidewire Software, Inc. in the
United States and/or other countries. Guidewire products are protected by one or more
United States patents.

This material is Guidewire proprietary and confidential. The contents of this material,
including product architecture details and APIs, are considered confidential and are fully
protected by customer licensing confidentiality agreements and signed Non-Disclosure
Agreements (NDAs).

This file and the contents herein are the property of Guidewire Software, Inc. Use of this
course material is restricted to students officially registered in this specific Guidewire-
instructed course, or for other use expressly authorized by Guidewire. Replication or
distribution of this course material in electronic, paper, or other format is prohibited without
express permission from Guidewire.
© Guidewire Software, Inc. 2001-2013. All rights reserved. Do not distribute without permission. 37

You might also like