11

Business Services

Copyright © 2009, Oracle. All rights reserved.

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

• Service scripts to perform functions that transcend MO's

• In this section, we'll discuss how you can use a different
technique to achieve similar results

11 - 2

Copyright © 2009, Oracle. All rights reserved.

All rights reserved.3 Copyright © 2009. change and delete MO's • For example. you create a business service and then invoke the business service in your BO rules and service scripts… 11 .Business Services Invoke Core Services • There are a multitude of base-package Java and Cobol services that do things other than read. generate and freeze an adjustment in one step • There’s a service that can easily add a log entry to a case • There's a service that can send an email message • There's a service that can verify a credit card number and debit the customer's account • … • You can imagine that being able to invoke these services would enrich your BO's and service scripts • To do this. • There’s a service that can add. . add. Oracle.

.Business Services Front-End Backend Services • A business service front-ends a service in the same way a business object front-ends a maintenance object A table linked to the person MO A BO’s schema maps the BO’s elements to the MO’s tables and fields MO Business Object IndividualTaxpayer BO Schema <taxpayerId mapField="PER_ID"/> <email mapField=“EMAILID"/> . All rights reserved. . 11 . Oracle....4 Service Program Business Service A service program that performs date arithmetic A BS’s schema maps the BS’s elements to the elements in the service program’'s XML document DateMath BS Schema <option mapField="OPTION_FLG"/> <beginDate mapField="BEGIN_DTTM"/> <endDate mapField="END_DTTM"/> . Copyright © 2009.

you'll learn how you can set up a business service to invoke a Java / Cobol service from the UI Script (Plug-in & Service) Step 11 .Business Services Are Invoked From Scripts • The main reason to set up a business service is so that your plug-in and service scripts can invoke the underlying Java / Cobol program • Foreshadowing – in the user-interface (UI) section of this class. Oracle.5 And yes. Edit data steps can also invoke business services Step Type • Conditional branch • Edit data • Go to a step • Invoke business object • Invoke business service • Invoke service script • Label • Move data • Terminate Copyright © 2009. . All rights reserved.

All rights reserved. .6 Copyright © 2009. Oracle.Team Walk Through (30 minutes) • Exploring business services • Break up into teams and follow the instructions in the workbook 11 .

Oracle.11 Business Services Not All Backend Common Routines Have Services Copyright © 2009. . All rights reserved.

Common Routines Without Service Programs • Due to time-constraints. . Oracle. some base-package common routines do not have a service program • This means you can’t create a business service for them • You have two choices: • You can find a CM developer to write a service program to wrap the common routine (this is coded in Java) – If you do this.8 Copyright © 2009. All rights reserved. you may want to send it to PD for inclusion in the next release so others can benefit from your hard work • You can log an SR and have PD do it – This may take longer than you can affored 11 .

11 Business Services Anomalous Interactions With Anomalous MO’s Copyright © 2009. . Oracle. All rights reserved.

or deleted via a BO. .Not All MO’s Can Be Maintained Via BO Interaction • A limited number of maintenance objects cannot be added. Oracle. changed. change or delete these MO’s. All rights reserved.10 Copyright © 2009. you must set up a business service to communicate directly with the MO’s service The system let’s you know on the BO transaction if the related MO is a “read only” 11 . these typically are transaction-oriented MO’s like: • • • • Bill Payment Adjustment Payment Plan • To add.

Note Well: All MO’s Can Be Read Via BO Interaction • You can use BO interaction to READ any MO • You can read BO's in service scripts. info zones and query zones • For example. all attributes on the MO are retrieved (even if you just need one) 11 . Oracle. All rights reserved. map zones. • You can retrieve a bill’s 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 • … • Efficiency Concerns – it is MUCH more efficient to read an MO using a BO interaction rather than using a business service call • This is because the framework only physically retrieves the data mapped in the BO's schema when you do a BO interaction • If you use a business service (that invokes the MO service). .11 Copyright © 2009.

2 • For example.State Transition Changes Cannot Be Done Via BO Interaction For Older MO's • You must use a business service to perform state changes for MO's that predate 2. Pending Start to Active. we only need the SA’s ID) Copyright © 2009. . you must set up a business service to communicate directly with the MO’s service: Service Program This is an example of a business service related to the SA Page Maintenance service Notice the pageAction= in the schema node 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 . you only need to map the ones that you care about (in this example. Oracle. All rights reserved.12 ActivateSA BS Schema <schema pageAction="update" > <saId mapField="SA_ID" /> <activate mapField="ACTIVATE_SW" default="true" private="true" /> These are two elements in the SA page service There are MANY other elements in the SA page service. say. if you want to change a SA’s state from.

11 Business Services Validation Copyright © 2009. Oracle. All rights reserved. .

Validating The Input Variables • You can use the dataType=… and required=“true” on the elements if you want the system to perform basic validation on the input parameters • This would be a "double-check" as the underlying service should have this validation… Service Program 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"/> . .14 Copyright © 2009. 11 . All rights reserved. Oracle...

Oracle.15 Copyright © 2009. please check your solution against the answer in your workbook 11 . . All rights reserved.Team Walk Through (60 minutes) • Add post-processing to a new child BO • Break up into teams and follow the instructions in the workbook Before you start adding any meta-data.

Oracle. . take a step back and ask yourself if you understand the concept being taught.16 Copyright © 2009. you can always return to the slides (and the related tips and user documentation) when you need to take advantage of these concepts in the future 11 . All rights reserved.Warning! .Advanced Concepts Ahead • The remainder of this section describes advanced concepts • If these concepts prove challenging.

. Oracle.11 Implementing Save Points Copyright © 2009. All rights reserved.

Oracle. return all errors rather than just the first one detected. if a Post Processing algorithm invokes a script and it throws an error. just save it and keep calling the other validation scripts. . 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.18 Copyright © 2009. All rights reserved. 11 . Then.Errors • By default. 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) • A classic example is when you want to call scripts to perform basic validation and if a validation error occurs. 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.

All rights reserved. 11 .19 The name of the service script and the script's data area are passed to the F1-SavePointDispatcher business service in its data area Copyright © 2009. .How To Issue A Save Point Before Executing A Service Script • The base-package is supplied with a business service called F1SavePointDispatcher • You pass this business service the name of the service script and the service script's data area (this is held in a "raw" element in the save point dispatcher's data area) • When invoked. move 'REMINDER' to "C1-RequestLetterDataArea/input/customerContactType". // populate the script name and its data area in the save point dispatcher's parameters move "C1-RequestLetterDataArea" to "F1-SavePointDispatcher/scriptData". it rolls back to the save point and returns the error message number to the caller (and the caller can do what it wants with it) // populate the service script's parameters move "personId" to "C1-RequestLetterDataArea/input/personId". • It then executes the script • If there are errors. Oracle. // invoke the save point dispatcher invokeBS 'F1-SavePointDispatcher' using "F1-SavePointDispatcher". move 'C1-ReqLetter' to "F1-SavePointDispatcher/scriptName". move 'CC' to "C1-RequestLetterDataArea/input/customerContactClass". this business service: • Issues a save point before it starts the script.

Oracle. . All rights reserved.11 Summary of default= Behavior Copyright © 2009.

21 Copyright © 2009.e. BO calls and BS calls linked to an MO service) or to a non-persistent object (i. All rights reserved. just because an element has a default= attribute doesn't mean the value will be defaulted … 11 . . 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.. Oracle.. but empty • If the element's node is not present • In other words.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.default= • You've seen how elements in BO.

If the person doesn't have a home address. . the remaining nodes will be added to the XML document. BS or SS data area is included in a script.Empty Nodes versus Not Present Nodes • Before describing the default= logic.22 If you were to look at the script's XML document prior to the execution of the move statement. the homeAddress nodes will be present. no nodes would be present. it's important to understand that when a BO.. 11 . <homeAddress type="group"> <country mapField="COUNTRY" /> <address1 mapField="ADDRESS1"/> <address2 mapField="ADDRESS2"/> <city mapField="CITY"/> <postal mapField="POSTAL"/> <state mapField="STATE"/> <homeAddress /> . its nodes are not present by default • The nodes are added as a result of move statements (or by the service being invoked) Let's assume this BO is included in a script's data area IndividualTaxpayer Schema <taxpayerId mapField="PER_ID"/> .... Oracle. but empty Copyright © 2009. After the invokeBO statement. you'd see one node present move '1232121211' to "IndividualTaxpayer/taxpayerId" invokeBO 'IndividualTaxpayer' using "IndividualTaxpayer" for read. If you were to look after the move statement. All rights reserved.

23 Copyright © 2009. defaulting always occurs (we assume that the value on the database should be populated with the default value if it's not present in the schema or has an empty value in the schema) – On update: — If the element is present but empty. defaulting will NOT occur regardless of whether the element is empty or not present 11 .. All rights reserved. defaulting will NOT occur (we assume the value in the database should remain) • Otherwise (the element has neither required="true" nor private="true") – On add: — If the element is present but empty.e. 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. all BO services or a BS service invocation that's linked to an MO service) and the element is either not specified or empty: • If the element also has an attribute of required="true" OR private="true": – On add.default= For Persistent Object Calls • If the underlying service is related to a persistent object (i. . 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 NOT occur (we assume because it’s not required on the database. Oracle. defaulting occurs (we assume the value in the database should reflect the default= value) — If the element is not present.

e. All rights reserved. .default= For Non-Persistent Object Calls • If the underlying service is related to a non-persistent object (i. defaulting will occur (we assume the element should contain the default value if it wasn't present) 11 .24 Copyright © 2009. defaulting will NOT occur (we assume the blank value is what the caller intended to pass) – If the element is not present. Oracle.. all SS invocations or a BS service invocation that's NOT linked to an MO service) and the element is either not specified or empty: • If the element also has an attribute of required="true" OR private="true": – Defaulting always occurs • Otherwise (the element has neither required="true" nor private="true"): – If the element is present but empty.

e.An Example • The activate element will default whenever this BS call is invoked because: • The BS is related to an MO service (i. . 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 This is an example of a business service related to the SA Page Maintenance service Notice the pageAction= in the schema node Business Service ActivateSA BS Schema <schema pageAction="update" > <saId mapField="SA_ID" /> <activate mapField="ACTIVATE_SW" default="true" private="true" /> Using the combination of default= and private= is a good way to "hard code" a value in an element 11 .. All rights reserved.25 Copyright © 2009. Oracle.

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.. 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. 11 ..e.26 Copyright © 2009. . Oracle... All rights reserved.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" /> .

Review Questions 11 . All rights reserved. .27 Copyright © 2009. Oracle.

Oracle.28 Copyright © 2009.11 . . All rights reserved.