Index: openacs-4/packages/acs-content-repository/www/doc/guide/types.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/www/doc/guide/types.adp,v
diff -u -r1.2.2.1 -r1.2.2.2
--- openacs-4/packages/acs-content-repository/www/doc/guide/types.adp 20 Aug 2015 17:19:50 -0000 1.2.2.1
+++ openacs-4/packages/acs-content-repository/www/doc/guide/types.adp 25 Aug 2015 18:02:05 -0000 1.2.2.2
@@ -4,16 +4,19 @@
The content repository requires you to define each type of
+ The content repository requires you to define each type of
content supported by your supplication. Content types are defined
as ACS Object Types, and may be created in the same
fashion as any other object type. This page provides some specific
examples and details related to defining ACS object types in the
-context of the content repository. A content item typically consists of two components:Defining Content Types
Defining Content Types
+Determine content attributes
+context of the content repository.
A content item typically consists of two components:
+Note that a content type does not have to store its + +
Note that a content type does not have to store its primary content in the BLOB column of the cr_revisions table. There is some additional overhead associated with retrieving small passages of text from the BLOB @@ -22,18 +25,22 @@ many items must be queried at the same time the difference may become significant. If the primary content will always be small, it is perfectly acceptable to store the content in an attribute column -instead.
Basic attributes for all content types are stored in the +instead.
+Basic attributes for all content types are stored in the cr_revisions (note that they are stored in the revisions table so that attributes may be updated for each new revision of the actual data). Most types of content require more than the basic attributes. For example, when storing images you will usually want to store the pixel height and width so that images can be selected -and sorted by size, as well as displayed efficiently.
Extended attributes associated with ACS object types may be +and sorted by size, as well as displayed efficiently.
+Extended attributes associated with ACS object types may be stored as key-value pairs in a central table (generic storage), or in a custom table whose primary key references the associated ACS object ID (specific storage). To ensure efficient access to attributes, the content repository API requires you to use specific -storage. Your table should have the form:
+storage. Your table should have the form: ++create table cr_content_type ( content_type_id integer constraint cr_content_type_id_fk @@ -42,12 +49,16 @@ primary key, attributes... ); -Note that your extended attribute table must reference the +
Note that your extended attribute table must reference the cr_revisions table, notcr_items. As mentioned above, this allows you to maintain multiple revisions of the attribute data in tandem with revisions of the content object -itself.
To define a content type, you should write an SQL script to -create the content type and then add attributes to it:
+itself. ++Use the Content Type API to create the content type
+To define a content type, you should write an SQL script to +create the content type and then add attributes to it:
+declare attr_id acs_attributes.attribute_id%TYPE; begin @@ -72,14 +83,16 @@ ); ... -The content_type methods use the core ACS Object Type +
The content_type methods use the core ACS Object Type API to create an object type for each content type, and to add attributes to the object type. In addition, content_type.create_type will create the extended attribute table with an appropriately defined primary key column (referencing its supertype) if the table does not already exist. Likewise, content_type.create_attribute will add a column -to the table if the column does not already exist.
Most importantly, the content_type methods call +to the table if the column does not already exist.
+Most importantly, the content_type methods call content_type.refresh_view after each change to the content type definition. Each content type must have an associated attribute view named @@ -89,9 +102,13 @@ acs_objects, cr_revisions, and all extended attribute tables in the class hierarchy of a particular content type. This view may be used to query attributes when serving -content.
In many cases your content items will serve as containers for +content.
+In many cases your content items will serve as containers for other items. You can include the set of allowable components as part of a content type definition. See Object Relationships for -details.
Last Modified: $Id: types.html,v 1.1.1.1 2001/03/13 22:59:26 ben +details.
+Last Modified: $Id: types.html,v 1.1.1.1 2001/03/13 22:59:26 ben Exp $
-