0% found this document useful (0 votes)
39 views30 pages

TA80 INTG020 GosuForIntegration

Uploaded by

vyshnavibatchu30
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views30 pages

TA80 INTG020 GosuForIntegration

Uploaded by

vyshnavibatchu30
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 30

Gosu for Integration

April 20, 2014

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


Do not distribute without permission.
Lesson objectives
• By the end of this lesson, you should be able to:
- Describe the places where an integration developer uses Gosu
- Create Gosu classes
- Use blocks as input parameters
- Generate unique, sequential numbers

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-2014. All rights reserved. Do not distribute without permission. 2
Lesson outline

• Overview of Gosu for integration

• Gosu classes

• Blocks

• Sequential numbers

© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 3
Review: Guidewire Gosu
• Guidewire's programming language
- Similar to Java and compatible with Java
- Has elements of both procedural
and object-oriented programming
languages
• Executes fundamental application
behavior
• Manages complex business processes
• Executes hierarchical business rules
• Specifies dynamic user interface
behavior

© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 4
Where is Gosu used for integration? (1)
• Predefined plugins
- Executes fundamental application
behavior, such as authentication
• Startable plugins
- Specifies how to listen for incoming
messages initiated by external systems
and how to reply to them
• Messaging plugins
- Asynchronously sends messages and
processes acknowledgements
• Messaging
- Event Fired rules
- Creates messages and generates payloads

© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 5
Where is Gosu used for integration? (2)
• Batch processes
- Specifies logic to run on a periodic basis

• Web services
- Specifies methods made available to
external applications for synchronous web WS-I
service calls

• Integration logic triggers include:


- Non-messaging business rules
- PCF actions (such as button clicks)
- Workflows

© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 6
Gosu features and benefits
• Code is more compact
- Direct access to Guidewire data model

c
• Development time is shorter
- Reload Classes or Make Project

• Guidewire Studio supports Gosu coding


- Code completion
- Syntax checking
- Navigable links

• Robust interaction with Java


- Easy to learn by Java programmers
- Has access to all Java types and can reference Java classes

© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 7
Gosu skills fundamental for integration
• Integration points involve these skills:
- Creating and modifying classes, including:
- Declaring and referencing properties and
methods
- Extending classes
- Creating and implementing interfaces
- Using blocks as input parameters
- Generating unique or sequential numbers
- Writing queries to retrieve data from the
Guidewire database
- Manually committing data to the database
- Using existing Java types and classes

© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 8
Additional Gosu features
• Advanced • Data • Testing
object-oriented transformation - Entity builders
design - XmlElement class - GUnit tests
- Enums to import, modify,
- Generics and/or export
XML
- Custom
- Typecode
annotations
mapper maps
- Numeric literals
Guidewire
- Intervals typecodes to
- Null-safe external system
operators typecodes and
vice versa

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

• Overview of Gosu for integration

• Gosu classes

• Blocks

• Sequential numbers

© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 10
Gosu classes
• Gosu classes are similar to classes in
other object-oriented language, such
as Java
• Classes are organized in packages
• Classes can define:
- Constructors
c
- Properties (with private and public access)
- Methods (with private and public access)

• Classes can:
- Extend other classes
- Implement interfaces
- Override methods

© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 11
Step 1: [Optional] Create a package

• In Project View, select gsrc


or an exisitng package in
…\configuration\gsrc\
- Context menu  New  Package

• Enter the package name


- Use dot notation to create a package hierarchy
- <company>.<app_code>.mechanism.<functional_area>

© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 12
Creating Gosu classes

• In Project View, select an exisitng package in


…\configuration\gsrc\
- Context menu  New  Gosu Class

• Use meaningful name with Pascal Case


- Capitalize the first letter in the identifier and the first letter of each
subsequent concatenated word
© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 14
Methods

• Methods are declared using the keyword function


- Methods can be private or public

• Like Java, methods can refer to the instance from which


the method is called using the key word this
© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 15
Properties

• In Gosu, a property is a private variable whose value is


manipulated publicly through getters and setters
• Shorthand is to declare the property with the as keyword
- private var _label: String as Label

© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 16
Extending a class
• To extend a class
- add extends
superClass to the class
declaration
• Super keyword gives
you access to aspects
of the superclass
• Override keyword lets
you override methods
Access to declared in the super
inherited
properties class

• As declared in the superclass, the class can access


non-private properties and methods
© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 17
Logging
1 package acme.ta.classes
2
…3 uses gw.api.system.PLLoggerCategory
…5 uses org.slf4j.Logger
6
…7 class Rectangle {
…10 protected var logger : Logger = PLLoggerCategory.CONFIG
…54 function enlarge(factor: int): String {
55 if (factor <= 0) {
56 logger.info("Rectangle.enlarge() invalid factor " + factor)
…58 }
…63 }
…64 }

• Use the slf4j logger and Guidewire static logger category


• XXLoggerCategory where XX is code
- AB, BC, CC, PC, PL

• Always use a logger instead of print() in production code

© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 18
Exception handling
1 package acme.ta.classes
2
…4 uses gw.api.util.DisplayableException
6
7 class Rectangle {
8
…54 function enlarge(factor: int): String {
55 if (factor <= 0) {
…57 throw new DisplayableException("Requires a factor greater
than 0")
…58 }
…63 }
…64 }

• Gosu code can throw Gosu and Java exceptions


• Gosu also handle catch exceptions with
try...catch...finally blocks

© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 19
Annotation support
1 package acme.ta.classes
2
…4 uses gw.api.util.DisplayableException
6
7 class Rectangle {
8
…50 @Param("factor", "Enlarge shape by this value.")
51 @Returns("A string that compare the original and current
areas.")
52 @Throws(DisplayableException, "Displayable exception if the
factor is <= 0.")
53 @Deprecated("Don't use Rectangle.enlarge(). Instead, use
Shape.enlargeByFactor()")
54 function enlarge(factor: int): String {
…63 }
…64 }

• An annotation is an expression starting with an @ that


provides metadata or implements a coding behavior
• Gosu provides annotations for code documentation
© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 20
Lesson outline

• Overview of Gosu for integration

• Gosu classes

• Blocks

• Sequential numbers

© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 21
Blocks
• A block is an unnamed method that is typically created as
an input parameter for another method
- For example, an array's where() method takes a block that specifies
a certain criteria and returns the elements in the array that match
that criteria

© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 22
Block syntax
• Syntax: (\argument(s) -> logicToExecute)

var generalNotes =
aContact.ContactNotes.where(\note ->

note.ContactNoteType == "general")
• In most cases, the object is iterable
• "note" is a placeholder name for elements from the array
• where() method returns all members of the array where the
block's Boolean condition is true

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

• Overview of Gosu for integration

• Gosu classes

• Blocks

• Sequential numbers

© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 24
The sequence utility
• The sequence utility is a Guidewire class that is used to
generate unique, sequential numbers
- Useful for business cases requiring numbers that are sequential or
unique
• Guidewire database stores sequence information
- For each sequence, it maintains a record of the last number
provided
• next() method is used to request numbers
- The database provides the next number in the given sequence

© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 25
Using the sequence utility
• Syntax: gw.api.system.database.
SequenceUtil.next(minVal, seqKey)

© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 26
SequenceUtil in action

• Gosu Scratchpad
- Line 3:
- First call "abc"
- Line 4: Call "abc"
- Second call "abc"
Call "abc"
- Line 5:
Call "xyz"
- Third call with "xyz"

© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 28
Lesson objectives review
• You should now be able to:
- Describe the places where an integration developer uses Gosu
- Create Gosu classes
- Use blocks as input parameters
- Generate unique, sequential numbers

© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 29
Review questions
1. A Gosu class is named Circle. Each instance must have a
property for the circle's radius. (This value can be
accessed and modified by methods in the Circle class, but
not by methods in other classes). How many elements
must you create to implement this?
2. The Circle class extends the Oval class and implements
the ICurveLine interface.
- Can Circle override methods from Oval?
- Can Circle override methods from ICurveLine?

3. What is the purpose of an annotation?


4. What types of methods make use of blocks?
5. (continued)

© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 30
Review questions
5. If the only sequence in the database has a key of "abc"
and the last number issued for sequence "abc" was 7,
what will be the return value of the following:
- SequenceUtil.next(1, "abc")
- SequenceUtil.next(15, "abc")
- SequenceUtil.next(1, "cba")

© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 31
Notices
Copyright © 2001-2014 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 DataHub, Guidewire InfoCenter, Guidewire Standard Reporting, Guidewire
ExampleCenter, Guidewire Account Manager Portal, Guidewire Claim Portal, Guidewire Policyholder
Portal, ClaimCenter, BillingCenter, PolicyCenter, InsuranceSuite, 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.

All other trademarks are the property of their respective owners.

This material is confidential and proprietary to Guidewire and subject to the


confidentiality terms in the applicable license agreement and/or separate
nondisclosure agreement.

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 products are protected by one or more United States patents.

© Guidewire Software, Inc. 2001-2014. All rights reserved. Do not distribute without permission. 32

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy