Creating the modifiable adapter
Next you must declare and define the modifiable
adapter for the modifiable entity in the new line of business. The modifiable
adapter contains methods for a modifiable object, such as methods to
add and remove modifiers. The Golf Cart line needs two modifiable entities,
GolfCartLine and GOCart. The following steps explain
how to define the GOModifiers
entity that provides coverage for the GolfCartLine.
Declare modifiable adapter on the modifiable entity
About this task
Declare the modifiable adapter for the new line of business.
Procedure
-
In Studio, open the modifiable
object.
For Golf Cart, open GolfCartLine.eti in .
-
Define the modifier subtype as an
arrayfrom the modified entity with the following properties:Property
Value
nameGOModifiers
arrayEntityGOModifier
descRating information for the line
-
Declare a modifiable delegate. The
modifiable delegate connects the modifiable entity with the modifier.
For the Golf Cart line, use the Studio Entity editor to add an
implementsEntityelement to the entity definition in GolfCartLine.eti:Property
Value
nameModifiable
-
Add an
implementsInterfaceelement to the modifiable entity. This element references the Gosu class that defines the adapter methods and properties.For the Golf Cart line, enter the following values:Property
Value
namegw.api.domain.ModifiableAdapter
adaptergw.lob.go.GOLineModifiableAdapter
What to do next
Create the modifiable adapter
Before you begin
About this task
After you declare the modifiable adapter
for the new line of business, you must write the code for the adapter.
Auto-complete in Studio helps you write the code. Create modifiable adapters
for each modifiable object. For Golf Cart, create modifiable adapters
for GolfCartLine and GOCart.
Procedure
-
In the Project
window in Studio, navigate in
to the
gw.lob.package package.For Golf Cart, navigate togw.lob.go. - Right click the package node, and then select .
-
Enter the name of the adapter. You
specified the name of the adapter in the
implementsEntityelement in the preceding procedure.For the GolfCartLine entity, the name of the modifiable adapter isGOLineModifiableAdapter.Note: Modifier instantiation is usually handled in the same manner as coverages using the gw.web.productmodel.ProductModelSyncIssuesHandler methods. -
In the new Gosu class, write a constructor
for the modifiable adapter.
For example, the Golf Cart modifiable adapter,
GOLineModifiableAdapter, code is.package gw.lob.go uses gw.api.domain.ModifiableAdapter uses java.util.Date class GOLineModifiableAdapter implements ModifiableAdapter { var _owner : GolfCartLine construct(owner : GolfCartLine) { _owner = owner } }This code produces a Gosu error in the class statement that you fix in the next step.
-
Place the insertion point at the error (after
ModifiableAdapter) and press Alt-Enter. Click the ImplementMethods command that pops up to open the Select Methods to Implement dialog box. With all listed methods selected, click OK to insert the empty methods into your code. - Write code for the new methods and properties. In most cases, the code for each method is a single line. Examine the modifier adapters for other lines of business as an example.
What to do next
Create the coverable modifiable adapter
Before you begin
About this task
Create the coverable modifiable adapter for the new line of business. If the entity is both and coverable and modifiable, then you must define a class that aggregates the implementations of gw.api.domain.CoverableAdapter and gw.api.domain.ModifiableAdapter. These interfaces have overlapping methods, so you must implement them in a single class.
Procedure
-
In the coverable and modifiable entity, in
implementsInterfacefor theCoverableAdapter, changeimpltogw.lob.go.GOLineCoverableModifiableAdapter. -
In
implementsInterfacefor theModifiableAdapter, changeimpltogw.lob.go.GOLineCoverableModifiableAdapter. - Using GLLineCoverableModifiableAdapter.gs as a model, create the adapter for the Golf Cart line.
- At this point, you can verify your work. For instructions, see Verify your work.
