Content starts here Add Update Map Procedures
This page last changed on Mar 11, 2008.

eDocs Home > BEA AquaLogic Data Services Platform Documentation > Data Services Developer's Guide > Contents

How To Add Update Map Procedures

This topic describes how to add a create, update, or delete procedure to a logical entity service.

Overview

In a logical entity service, you can add create, update, and delete procedures (called update map procedures) that act on underlying data sources. A procedure is an operation that can have side effects, for example, a create procedure that adds a new record to a database table and returns a key value.

You can create update map procedures visually in Studio and have the framework generate XQuery pragma statements and source code, or you can write the source code directly in XQuery or XQSE.

The XQuery pragma statement looks something like this:

(::pragma  function <f:function kind="create" visibility="public" isPrimary="true" xmlns:f="urn:annotations.ld.bea.com">

This statement defines a create procedure, with public visibility, that is primary. Even though the pragma statement uses the keyword function, the operation you define is a procedure, as you can see from the declaration:

declare procedure cus:createCustomerAndAddress($arg as element(cus:CustomerAndAddress)*) as element(cus:CustomerAndAddress_KEY)\* external;

This line declares the procedure with the name createCustomerAndAddress, defines one argument with the service's return type, and specifies a key as a return value.

Generate Default Procedures

When you generate default update map procedures, they have these parameters and return values:

Type Parameters
Return Value
Create The service's Return type
The current key, empty if no key is defined   
Update
The service's Return type using a changed-element kind 
Empty
Delete
The service's return type
Empty

Before you create update map procedures, especially create procedures, add a key to your service. A primary create procedure must return a key. Primary update and delete procedures require the Return type as an argument; their non-primary equivalents can be written to accept a key instead.

To generate a default update map procedure:

  1. Create a key for your service.
  2. In the Overview tab, right-click at the left, right, or top, and choose Add Update Map Procedures.
     


  3. Select Add to indicate which procedures to add.
  4. Add names in the Name fields.
  5. Mark Primary to indicate if each procedure should be primary.
  6. Click OK.
     


  7. In the Overview tab, right-click a procedure name and choose Edit Signature.
     


  8. Make any necessary changes to the procedure signature in the dialog box.

Design Custom Procedures

You can also create procedures with the arguments and return types you choose. This is useful for procedures in addition to the primary create, update, and delete procedures.

To design custom procedures:

  1. Click Overview.
  2. Right-click at the top, left, or right, and choose Add Operation.
  3. Choose a value for Visibility.
  4. At Kind, choose create, update, or delete.
  5. At Name, enter a procedure name.
     


  6. (Optional) At Return Type, click Edit. Choose a primitive or complex type, then click OK.
  7. At Parameters, click Add.
  8. Choose a primitive or complex type from an XML or XSD file, then click OK.
  9. At Kind, choose a value.
    Choose element to use the exact XML element you selected as a parameter; changed-element, if values in the element must be updated; schema-element, if the element must be validated according to an XML schema.
  10. At Occurrence, choose a value.
  11. Click OK in both dialog boxes.

See Also

Concepts
How Tos



Document generated by Confluence on Apr 28, 2008 15:57