27
Copyright Oracle Corporation, 1999. All rights reserved. 22 22 Sharing Objects and Code

Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

Embed Size (px)

Citation preview

Page 1: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

Copyright Oracle Corporation, 1999. All rights reserved.

22222222

Sharing Objects and CodeSharing Objects and Code

Page 2: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-22 Copyright Oracle Corporation, 1999. All rights reserved.

ObjectivesObjectives

After completing this lesson, you should be able to do the following:

• Describe the various methods for reusing objects and code

• Inherit properties from property classes

• Group related objects for reuse

• Reuse objects from an object library

• Reuse PL/SQL code

After completing this lesson, you should be able to do the following:

• Describe the various methods for reusing objects and code

• Inherit properties from property classes

• Group related objects for reuse

• Reuse objects from an object library

• Reuse PL/SQL code

Page 3: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-33 Copyright Oracle Corporation, 1999. All rights reserved.

Sharing and Reusing CodeSharing and Reusing Code

• Increases productivity

• Decreases maintenance

• Increases modularity

• Maintains standards

• Increases productivity

• Decreases maintenance

• Increases modularity

• Maintains standards

Page 4: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-44 Copyright Oracle Corporation, 1999. All rights reserved.

Property ClassesProperty Classes

LOV

properties

Block

properties

Canvas

properties

Relation

properties

Item

properties

Page 5: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-55 Copyright Oracle Corporation, 1999. All rights reserved.

Property Class IconsProperty Class Icons

Add PropertyAdd Property Inherit PropertyInherit Property

Property ClassProperty ClassDelete PropertyDelete Property

Page 6: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-66 Copyright Oracle Corporation, 1999. All rights reserved.

Property palette

Default property

Inherited and Variant PropertiesInherited and Variant Properties

Default property

Default property

Property palette

Default property

Default property

Changed propertyChangeChangeDefault property

Property class

Apply

Property palette

Inherited property

Inherited property

Property palette

Inherited property

Inherited property

Variant property

ChangeChange

Inherited propertyInheritInherit

Inherited property

Page 7: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-77 Copyright Oracle Corporation, 1999. All rights reserved.

Inheriting PropertiesInheriting Properties

• Set the Subclass Information property.

• Convert an inherited property to a variant property.

• Convert a variant property to an inherited property.

• Set the Subclass Information property.

• Convert an inherited property to a variant property.

• Convert a variant property to an inherited property.

Page 8: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-88 Copyright Oracle Corporation, 1999. All rights reserved.

Object GroupObject Group

• Is a logical container

• Enables you to:

– Group related objects

– Copy multiple objects in one operation

• Is a logical container

• Enables you to:

– Group related objects

– Copy multiple objects in one operation

Page 9: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-99 Copyright Oracle Corporation, 1999. All rights reserved.

Using Object GroupsUsing Object Groups

• Blocks include:

– Items

– Item-level triggers

– Block-level triggers

– Relations

• Object groups cannot include other object groups

• Deleting:

– An object group does not affect the objects

– An object affects the object group

• Blocks include:

– Items

– Item-level triggers

– Block-level triggers

– Relations

• Object groups cannot include other object groups

• Deleting:

– An object group does not affect the objects

– An object affects the object group

Page 10: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-1010 Copyright Oracle Corporation, 1999. All rights reserved.

Copying ObjectsCopying Objects

Ability to Ability to make exactmake exactcopy of objectcopy of object

Company Name:

Company Code:

Balance:

Company Name:

Company Code:

Balance:

Page 11: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-1111 Copyright Oracle Corporation, 1999. All rights reserved.

What Is Subclassing?What Is Subclassing?

Ability to Ability to make exactmake exactcopy of objectcopy of object

Ability to add Ability to add to objectto object

Company Name:

Company Code:

Balance:

Company Name:

Company Code:

Balance:

Address:

Code:

Company Name:

Company Code:

Balance:

Page 12: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-1212 Copyright Oracle Corporation, 1999. All rights reserved.

SubclassingSubclassing

Ability to Ability to make exactmake exactcopy of objectcopy of object

Ability to add Ability to add to objectto object

AbilityAbilityto alterto alterpropertiesproperties

Company Name:

Company Code:

Balance:

Company Name:

Company Code:

Balance:

Address:

Code:

Company Name:

Company Code:

Balance:

Company Name:

Company Code:

Balance:

Page 13: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-1313 Copyright Oracle Corporation, 1999. All rights reserved.

Inheriting ChangesInheriting Changes

Company Name:

Company Code:

Balance:

Company Name:

Company Code:

Balance:

Company Name:

Company Code:

Balance:

Company Name:

Company Code:

Balance:

Address:

Code:

Make changes to parentMake changes to parent

AbilityAbilityto inheritto inheritchangeschanges

AbilityAbilityto inheritto inheritchangeschanges

AbilityAbilityto inheritto inheritchangeschanges

Page 14: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-1414 Copyright Oracle Corporation, 1999. All rights reserved.

An Object LibraryAn Object Library

• Is a convenient container of objects for reuse

• Simplifies reuse in complex environments

• Supports corporate, project, and personal standards

• Simplifies the sharing of reusable components

• Is a convenient container of objects for reuse

• Simplifies reuse in complex environments

• Supports corporate, project, and personal standards

• Simplifies the sharing of reusable components

Page 15: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-1515 Copyright Oracle Corporation, 1999. All rights reserved.

Object LibrariesObject Libraries

• Appear in the Navigator if they are open

• Are used with a simple tabbed interface

• Are saved to .olb file or to database

• Appear in the Navigator if they are open

• Are used with a simple tabbed interface

• Are saved to .olb file or to database

Page 16: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-1616 Copyright Oracle Corporation, 1999. All rights reserved.

Benefits of the Object LibraryBenefits of the Object Library

• Simplifies the sharing and reuse of objects

• Provides control and enforcement of standards

• Eliminates the need to maintain multiple referenced forms

• Simplifies the sharing and reuse of objects

• Provides control and enforcement of standards

• Eliminates the need to maintain multiple referenced forms

Page 17: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-1717 Copyright Oracle Corporation, 1999. All rights reserved.

A SmartClassA SmartClass

• Is an object in an object

library that is frequently

used as a class

• Can be applied easily and

rapidly to existing objects

• Can be defined in many

object libraries

You can have many

SmartClasses of a given object type.

• Is an object in an object

library that is frequently

used as a class

• Can be applied easily and

rapidly to existing objects

• Can be defined in many

object libraries

You can have many

SmartClasses of a given object type.Check indicates a SmartClass.Check indicates a SmartClass.Check indicates a SmartClass.Check indicates a SmartClass.

Page 18: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-1818 Copyright Oracle Corporation, 1999. All rights reserved.

Working with SmartClassesWorking with SmartClasses

1. Select an object in theLayout Editor or Navigator.

2. From the pop-up menu,select SmartClasses.

3. Select a class from the list.

1. Select an object in theLayout Editor or Navigator.

2. From the pop-up menu,select SmartClasses.

3. Select a class from the list.

Page 19: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-1919 Copyright Oracle Corporation, 1999. All rights reserved.

Reusing PL/SQLReusing PL/SQL

• Triggers:

– Copy and paste text

– Copy and paste within a module

– Copy to or subclass from another module

– Move to an object library

• PL/SQL program units:

– Copy and paste text

– Copy and paste within a module

– Copy to or subclass in another module

– Create a library module

– Move to an object library

• Triggers:

– Copy and paste text

– Copy and paste within a module

– Copy to or subclass from another module

– Move to an object library

• PL/SQL program units:

– Copy and paste text

– Copy and paste within a module

– Copy to or subclass in another module

– Create a library module

– Move to an object library

Page 20: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-2020 Copyright Oracle Corporation, 1999. All rights reserved.

PL/SQL LibrariesPL/SQL Libraries

ApplicationsApplications

Form modulesForm modulesMenu modulesMenu modules

Report modulesReport modulesGraphic modulesGraphic modules

.pll.pll ororDatabaseDatabase

Procedures

Functions

Packages

LibraryLibrary

Page 21: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-2121 Copyright Oracle Corporation, 1999. All rights reserved.

Writing Code for LibrariesWriting Code for Libraries

• A library is a separate module, holding procedures, functions, and packages.

• Direct references to bind variables are not allowed.

• Use subprogram parameters for passing bind variables.

• Use functions, where appropriate, to return values.

• A library is a separate module, holding procedures, functions, and packages.

• Direct references to bind variables are not allowed.

• Use subprogram parameters for passing bind variables.

• Use functions, where appropriate, to return values.

Page 22: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-2222 Copyright Oracle Corporation, 1999. All rights reserved.

Creating Library Program UnitsCreating Library Program Units

Page 23: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-2323 Copyright Oracle Corporation, 1999. All rights reserved.

Attach Library Dialog BoxAttach Library Dialog Box

Page 24: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-2424 Copyright Oracle Corporation, 1999. All rights reserved.

Calls and SearchesCalls and Searches

procedure ( );

...function...

package.call ( );

procedure ( );

...function...

package.call ( ); •Program Units

PROCA

PROCB

•Attached Libraries•Database

CallsCalls

SearchesSearches

Page 25: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-2525 Copyright Oracle Corporation, 1999. All rights reserved.

SummarySummary

• Reasons to share objects and code:

– Increased productivity

– Increased modularity

– Decreased maintenance

– Maintaining standards

• Reasons to share objects and code:

– Increased productivity

– Increased modularity

– Decreased maintenance

– Maintaining standards

Page 26: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-2626 Copyright Oracle Corporation, 1999. All rights reserved.

SummarySummary

• Methods of sharing objects and code:

– Using property classes

– Using object groups

– Copying

– Subclassing

– Creating a library module

– Using object libraries

• Methods of sharing objects and code:

– Using property classes

– Using object groups

– Copying

– Subclassing

– Creating a library module

– Using object libraries

Page 27: Copyright Ó Oracle Corporation, 1999. All rights reserved. 2222 Sharing Objects and Code

22-22-2727 Copyright Oracle Corporation, 1999. All rights reserved.

Practice 22 OverviewPractice 22 Overview

This practice covers the following topics:

• Creating an object group and using this object group in a new form module

• Using property classes

• Creating an object library and using this object library in a new form module

• Setting and using SmartClasses

This practice covers the following topics:

• Creating an object group and using this object group in a new form module

• Using property classes

• Creating an object library and using this object library in a new form module

• Setting and using SmartClasses