Index: openacs-4/packages/acs-core-docs/www/objects.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/objects.html,v diff -u -r1.32.2.4 -r1.32.2.5 --- openacs-4/packages/acs-core-docs/www/objects.html 22 Oct 2004 02:38:14 -0000 1.32.2.4 +++ openacs-4/packages/acs-core-docs/www/objects.html 1 Nov 2004 23:39:57 -0000 1.32.2.5 @@ -1,7 +1,7 @@ -OpenACS Data Models and the Object System

OpenACS Data Models and the Object System

By Pete Su

+OpenACS Data Models and the Object System

OpenACS Data Models and the Object System

By Pete Su

OpenACS docs are written by the named authors, and may be edited by OpenACS documentation staff. -

Overview

+

Overview

Developing data models in OpenACS 5.1.2 is much like developing data models for OpenACS 3, save for the implementation. As usual, you need to examine how to model the information that the application must store and @@ -51,7 +51,7 @@ object and forget about it.

  • And most importantly, any future object-level service - from a general-comments replacement to personalized ranking - will become available to your application "for free."

  • -

    How to Use Objects

    +

    How to Use Objects

    Using ACS objects is straightforward: all that's required are a few extra steps in the design of your application data model.

    @@ -78,7 +78,7 @@ Fire up your text editor and open the ROOT/packages/notes/sql/oracle/notes-create.sql (ROOT/packages/notes/sql/postgresql/notes-create.sql for the PG version) file created when we created the package. Then, do the following: -

    Describe the new type to the type system

    +

    Describe the new type to the type system

    First, add an entry to the acs_object_types table with the following PL/SQL call:

     begin  
    @@ -138,7 +138,7 @@
     because the new type note is a subtype of
     acs_object, it will inherit these attributes, so there is
     no need for us to define them.
    -

    Define a table in which to store your objects

    +

    Define a table in which to store your objects

    The next thing we do is make a small modification to the data model to reflect the fact that each row in the notes table represents something that is not only an object of type @@ -163,7 +163,7 @@ use the acs_objects table to find objects will transparently find any objects that are instances of any subtype of acs_objects. -

    Define a package for type specific procedures

    +

    Define a package for type specific procedures

    The next step is to define a PL/SQL package for your new type, and write some basic procedures to create and delete objects. Here is a package definition for our new type: @@ -211,7 +211,7 @@ object OBJ was "read only", then any other object that used OBJ as its context would also be "read only" by default. We'll talk about this more later. -

    Define a package body for type specific procedures

    +

    Define a package body for type specific procedures

    The PL/SQL package body contains the implementations of the procedures defined above. The only subtle thing going on here is that we must use acs_object.new to insert a row into @@ -289,7 +289,7 @@ drop package note; drop table notes; -

    When to Use Objects

    +

    When to Use Objects

    While it is hard to give general design advice without knowing anything about a particular application, you should follow the following rule of thumb when deciding when to hook part of your data @@ -309,7 +309,7 @@ kind of design decision is mostly made on an application-by-application basis, but this is a good baseline from which to start. -

    Design Guidance

    +

    Design Guidance

    In this section we cover some overall guidelines for designing data models that are meant to be integrated with the OpenACS object system. @@ -368,7 +368,7 @@ when to use inherited attributes is fairly straightforward, but requires a good amount of thought at design time even for simple applications. -

    Summary

    +

    Summary

    Hooking into the OpenACS 5.1.2 object system brings the application developer numerous benefits, and doing it involves only four easy steps: