Simple Overview of Content Repository


This document is to give an overview of the Content Repository so enough knowledge about it can be used to start developing on BCMS. Things stated here may not be what is in real in fact on CR, but for simplicity sake and basic overview.

What is the Content Repository?

Content Repository logically functions as a file system. Content items can be stored in folders (Content Folders). Content items are like files, and Content folders are like... well folders. The difference between a file system and the CR is that content items may have 1 or more revisions. For example text content item may have 3 versions. A content item may also hold a property / state, which version is a live version. Normally the live version is the one that we publish or display on the public web site. Essentially its a central place where we can stuff different content, and since it the basic data model and functions are done. Your content will inherit those abilities and properties, such as versioning, categorization, relations, etc.

Simplified View of CR



Common db tables and columns used:


Note: omissions has been made on the columns to simplify.


cr_items


Column | Type

------------------+------------------------

item_id | integer

parent_id | integer

name | character varying(400)

live_revision | integer

latest_revision | integer

publish_status | character varying(40)

content_type | character varying(100)

storage_type | character varying(10)


item_id - is the unique id of an item on CR. Its the acs object id.

parent_id  normally this the item_id of the folder that stores the item.

name  normally use as a url part. Similar to filename on the file system.

live_revision  if a particular item has a live version, this field stores the version id, which refers to cr_revisions table.

latest_revision  this the version id of the latest version, this is kept automatically triggers.

publish_status  values are production, ready, live and expired.

content_type  can kind of type is this item

storage_type  the values are text, file and lob. If the value of the content is stored on cr_revisions.content then the value is text. If the content is store on a file on acs_root/content-repository-content-files then the value is file. The lob value is used if the content is stored in the db using lobs.


cr_revisions


Column | Type

----------------+--------------------------

revision_id | integer

item_id | integer

title | character varying(1000)

description | text

publish_date | timestamp with time zone

mime_type | character varying(200)

content | text


revision_id  a unique id for a version

item_id  which version does this revision belong to

title  title of the version

description  description of the content

publish_date  if the version has been publish, the date is stored here

mime_type  mime type of the content

content  this is where content is stored if cr_items.storage_type is set to text


cr_folders


Column | Type

--------------------+-------------------------

folder_id | integer

label | character varying(1000)

description | text


folder_id  a unique number for a folder, this is a foreign key for cr_items.item_id. So a folder is a special type of content.

label  friendly/pretty name of a folder.

What are Content Types?

Content Types are similar to file type. In a conventional file system a .doc and .xls file differs on both type and content. One is for a word processor another one is for a spread sheet. The same way CR can accommodate different content types. Normally we need to define our content type since the very basic CR content types may not be enough. For example if we would like to have a sub title field we need to create a custom content type. This CR object model diagram where custom content types in the ACS Object model.


How can I add Content?

Normally you can insert on a view or call a plsql calls to insert to CR. With bcms you can do the following:


set my_new_item [bcms::item::create_item -item_name testing -parent_id $my_folder]

# lets put our initial version

bcms::revision::add_revision -item_id $my_new_item -title this is a test page -description this page is to test adding content to CR -content blah....


Although the following command above can be wrapped and just simply use one call, for example:


bcms::create_page -page_name testing -folder_id $my_folder -title this is a test page -description this page is to test adding content to CR -page_body blah....

How can I get Content?

There should be different ways to get content. Since its basically a database one can select the values. Normally in bcms or create a bcds. You do the following.


  1. On a index.vuh file, you get the url

  2. Use the following call:

    array set mycontent [bcms::item::get_item_by_url -root_id $my_root_folder -url $url_requested -revision live -resolve_index]

  3. on your adp file:
    <html>

    <title>@mycontent.title@</title>

    <body>

    <h1>@mycontent.title@</h1>

    <h3>@mycontent.description@</h3>

    @mycontent.content@
    </body></html>