OWB SDK: Scripting Custom Object Definitions

Oracle Warehouse Builder 10g

Scripting Language - Custom Object Definitions

This section describes how you can add and modify custom object definitions. You can add user defined properties to the current Warehouse Builder metadata objects.

Table of contents

Custom object definition Examples

One of the distinguishing features of the repository is the capability to add your own metadata to existing objects. This section shows you some more in-depth examples on the extension of the objects and the maintenance of the user defined properties.

OMBREDEFINE CLASS_DEFINITION

The OMBREDEFINE command covers all aspects of redefinition. You can use this command to add, delete and modify your user defined properties.

ADD
As you have seen in the overall section, you can add properties to an object. The following example shows you some more options while adding the property to an object.

When adding a property you cannot set the business name. Attempting to do so will give you error “OMB01134: Can not set business name when adding property definition.” You have to set the business name in the modify command.

OMBREDEFINE CLASS_DEFINITION 'VIEW' \
ADD PROPERTY_DEFINITION 'UDP_OWNER' \
SET PROPERTIES (TYPE, DEFAULT_VALUE) VALUES ('STRING', 'REP_OWNER')

OMBREDEFINE CLASS_DEFINITION 'TABLE' \
ADD PROPERTY_DEFINITION 'UDP_COUNT' \
SET PROPERTIES (TYPE, DEFAULT_VALUE) VALUES ('INTEGER', 00)

In some cases you may be interested to add links to documentation in the repository. You can do this using user defined properties. The following example shows how to create an HTML link from the Warehouse Builder screens.

OMBREDEFINE CLASS_DEFINITION 'VIEW' \
ADD PROPERTY_DEFINITION 'UDP_LINK' \
SET PROPERTIES (TYPE, DEFAULT_VALUE) VALUES ('URL', 'http://www.oracle.com')

In the user interface, users can now link from a view to the Oracle home page. Of course you can link to internal sites to add documentation to the Warehouse Builder metadata.

In a similar way you can link files. In the case of the AW.SQL file the UDP_FILE is defined as type URL but with the file path as a value. Warehouse Builder will invoke the default handler for the file, and as long as that is defined your file (or link) will open the object. Obviously the user must have access to the file or URL and it is therefore best to set this directory path relative to the repository server.

Once you have added information this way you can change it in the UI. If you click the file or the URL it will be launched, so you can click the […] button to change the content.

Other examples are a version date which can be added to the object. Note you can also use the Snapshot functionality in Warehouse Builder to maintain versions.

OMBREDEFINE CLASS_DEFINITION 'VIEW' \
ADD PROPERTY_DEFINITION 'UDP_VERSION' \
SET PROPERTIES (TYPE, DEFAULT_VALUE) VALUES ('DATE', '2004-10-02')

Back to Top

DELETE
Removing a user-defined property can be done by issuing the simpler DELETE clause on the object.

OMBREDEFINE CLASS_DEFINITION 'VIEW' \
DELETE PROPERTY_DEFINITION 'UDP_OWNER'

Once you have deleted the user defined property make sure you COMMIT the changes to the repository.

Back to Top

MODIFY
The MODIFY clause allows you change the definition of the user defined property. Note that you cannot change the type of the property once it is created. To change the type you will have to delete it and recreate it.

OMBREDEFINE CLASS_DEFINITION 'VIEW' \
MODIFY PROPERTY_DEFINITION 'UDP_OWNER' \
SET PROPERTIES (BUSINESS_NAME) VALUES ('UDP_Object Owner')

Note that the business name has to start with UDP_ as well. Any name without UDP_ will be rejected and lead to an error (OMB01133: The name of User Defined Property must be prefixed with 'UDP_').

Back to Top

OMBDESCRIBE CLASS_DEFINITION

Use the OMBDESCRIBE in this case to inspect the user defined property.

OMBDESCRIBE CLASS_DEFINITION 'VIEW' PROPERTY_DEFINITION 'UDP_Object Owner'  \
GET PROPERTIES (TYPE, DEFAULT_VALUE, BUSINESS_NAME)

When issued the output of this command is:

OMB+> STRING REP_OWNER {UDP_Object Owner}

When you want the properties on the class (for example on the view type here) you can issue:

OMBDESCRIBE CLASS_DEFINITION 'VIEW' \
GET PROPERTY_DEFINITIONS

When issued the output is:

{UDP_Object Owner}

 

E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy