Professional Documents
Culture Documents
Business Services
Check Point
Up to now, we've discussed how you can develop:
Business objects to read, add, change, delete MO's
BO's are also useful to handle state-specific processing
11 - 2
You can imagine that being able to invoke these services would enrich
your BO's and service scripts
To do this, you create a business service and then invoke the
business service in your BO rules and service scripts
11 - 3
MO
Business
Object
IndividualTaxpayer BO Schema
<taxpayerId mapField="PER_ID"/>
<email mapField=EMAILID"/>
...
11 - 4
Service
Program
Business
Service
DateMath BS Schema
<option mapField="OPTION_FLG"/>
<beginDate mapField="BEGIN_DTTM"/>
<endDate mapField="END_DTTM"/>
...
Step
11 - 5
Step Type
Conditional branch
Edit data
Go to a step
Invoke business object
Invoke business service
Invoke service script
Label
Move data
Terminate
11 - 6
11
Business Services
11 - 8
11
Business Services
Bill
Payment
Adjustment
Payment Plan
11 - 10
For example,
You can retrieve a bills bill date by setting up a bill BO
You can retrieve the collection of bill lines from a bill segment by
setting up a bill segment BO
Service
Program
Business
Service
Notice the usage of
default= and private= (this
means the invokers of this
service don't even know
about the activate
element)
11 - 12
ActivateSA BS Schema
<schema pageAction="update" >
<saId mapField="SA_ID" />
<activate mapField="ACTIVATE_SW" default="true" private="true" />
11
Business Services
Validation
Business
Service
DateMath BS Schema
<option mapField="OPTION_FLG" dataType="lookup" lookup="OPTION_FLG"/>
<beginDate mapField="BEGIN_DTTM" dataType="dateTime" required="true"/>
<endDate mapField="END_DTTM" datatype="dateTime"/>
...
11 - 14
11 - 15
11 - 16
11
Errors
By default, any error produced by a service script causes a roll
back of ALL changes that occurred before the error occurred
(including any changes done by the BO / service script that
invoked the script)
For example, if a Post Processing algorithm invokes a script and it
throws an error, the algorithm will also error and the entire
transaction will roll back
There is a way for the caller to tell the framework the following:
Take a save point before the service script starts
If there's an error in the script, roll back changes to the save point and
return the error to the caller (the caller can then determine what to do
with the error)
11 - 18
11 - 19
11
default=
You've seen how elements in BO, BS and SS schemas can have an
attribute of default=
This attribute is used to default an element's value if its node is not
specified in the service call or if it's specified with an empty value
The upcoming slides will describe when the system defaults the
specified value based on a combination of the following factors:
Is the service call is related to a persistent object (i.e., BO calls and BS
calls linked to an MO service) or to a non-persistent object (i.e., SS calls
and BS calls linked to a non-MO service)
If the element has required="true" or private="true" attributes
If the related database action is add or update (for persistent object calls)
If the element's node is present, but empty
If the element's node is not present
11 - 21
11 - 22
If the element is present but empty, defaulting occurs (we assume the value in the database
should reflect the default= value)
If the element is not present, defaulting will NOT occur (we assume the value in the
database should remain)
If the element is present but empty, defaulting will NOT occur (we assume because its not
required on the database, the "blank" value in the service call is the value that should be
put into the database)
If the element is not present, defaulting will occur (we assume because the service doesn't
contain the element that the default value in the schema should be put into the database)
On update, defaulting will NOT occur regardless of whether the element is empty or not present
11 - 23
11 - 24
An Example
The activate element will default whenever this BS call is invoked because:
The BS is related to an MO service (i.e., it's a persistent object call)
The pageAction is "update"
The element has an attribute of private="true" (the framework will always add private elements to the XML
document and therefore the element will always be present and empty by the time the default logic kicks in)
Service
Program
Business
Service
ActivateSA BS Schema
<schema pageAction="update" >
<saId mapField="SA_ID" />
<activate mapField="ACTIVATE_SW" default="true" private="true" />
Another Example
The option element will default if it's not specified or empty whenever this BS call is invoked because:
The BS is not related to an MO service (i.e., it's a non-persistent object call)
The element has an attribute of required="true"
The endDate element will only default if it's not present in the schema because:
The BS is not related to an MO service (i.e., it's a non-persistent object call)
Because it's not required it must be possible for the caller to set it to blank
Service
Program
Business
Service
DateMath BS Schema
<option mapField="OPTION_FLG" required="true" default="DIFF" />
<beginDate mapField="BEGIN_DTTM" required="true"/ >
<endDate mapField="END_DTTM" default="%CurrentDate" />
...
11 - 26
Review Questions
11 - 27
11 - 28