## content_revision

Content Repository : content_revision

- Overview
- Related Objects
- API

### Overview

Content revisions contain the data for content items. There is a many to one relationship between content revisions and content items. There is at most one "live" revision for every content item though. For example, there may be 5 revisions of the review for the movie "Terminator," yet only one of these may be live on the website at a given time.

### Related Objects

See also: {content_item }

### API

- Function: content_revision.copy

  Creates a new copy of an attribute, including all attributes

  Author: | Karl Goldstein
  Parameters:

  > revision_id: |  | The id of the revision to copy

  Declaration:

      function copy (
        revision_id	in cr_revisions.revision_id%TYPE,
        copy_id	in cr_revisions.revision_id%TYPE default null
      ) return cr_revisions.revision_id%TYPE;

  See Also: | content_revision.new

- Function: content_revision.export_xml

  Parameters:
  Not yet documented
  Declaration:

      function export_xml (
        revision_id IN cr_revisions.revision_id%TYPE
      ) return cr_xml_docs.doc_id%TYPE;

- Function: content_revision.get_number

  Return the revision number of the specified revision, according to the chronological order in which revisions have been added for this item.

  Author: | Karl Goldstein
  Returns: | The number of the revision
  Parameters:

  > revision_id: |  | The id the revision

  Declaration:

      function get_number (
        revision_id   in cr_revisions.revision_id%TYPE
      ) return number;

  See Also: | content_revision.new

- Function: content_revision.import_xml

  Parameters:
  Not yet documented
  Declaration:

      function import_xml (
        item_id IN cr_items.item_id%TYPE,
        revision_id IN cr_revisions.revision_id%TYPE,
        doc_id IN number
      ) return cr_revisions.revision_id%TYPE;

- Function: content_revision.new

  Create a new revision for an item.

  Author: | Karl Goldstein
  Returns: | The id of the newly created revision
  Parameters:

  > title: |  | The revised title for the item
  > description: |  | A short description of this revision, 4000 characters maximum
  > publish_date: |  | Publication date.
  > mime_type: |  | The revised mime type of the item, defaults to 'text/plain'
  > nls_language: |  | The revised language of the item, for use with Intermedia searching
  > data: |  | The blob which contains the body of the revision
  > item_id: |  | The id of the item being revised
  > revision_id: |  | The id of the new revision. A new id will be allocated by default
  > creation_date: |  | As in `acs_object.new`
  > creation_ip: |  | As in `acs_object.new`
  > creation_user: |  | As in `acs_object.new`

  Declaration:

      function new (
        title         in cr_revisions.title%TYPE,
        description   in cr_revisions.description%TYPE default null,
        publish_date  in cr_revisions.publish_date%TYPE default sysdate,
        mime_type   	in cr_revisions.mime_type%TYPE default 'text/plain',
        nls_language 	in cr_revisions.nls_language%TYPE default null,
        data	        in cr_revisions.content%TYPE,
        item_id       in cr_items.item_id%TYPE,
        revision_id   in cr_revisions.revision_id%TYPE default null,
        creation_date	in acs_objects.creation_date%TYPE
      			   default sysdate,
        creation_user	in acs_objects.creation_user%TYPE
      			   default null,
        creation_ip	in acs_objects.creation_ip%TYPE default null
      ) return cr_revisions.revision_id%TYPE;

  See Also: | acs_object.new, content_item.new

- Function: content_revision.read_xml

  Parameters:
  Not yet documented
  Declaration:

      function read_xml (
        item_id IN number,
        revision_id IN number,
        clob_loc IN clob
      ) return number as language
        java
      name
        'com.arsdigita.content.XMLExchange.importRevision(
           java.lang.Integer, java.lang.Integer, oracle.sql.CLOB
        ) return int';

- Function: content_revision.write_xml

  Parameters:
  Not yet documented
  Declaration:

      function write_xml (
        revision_id IN number,
        clob_loc IN clob
      ) return number as language
        java
      name
        'com.arsdigita.content.XMLExchange.exportRevision(
           java.lang.Integer, oracle.sql.CLOB
        ) return int';

- Procedure: content_revision.delete

  Deletes the revision.

  Author: | Karl Goldstein
  Parameters:

  > revision_id: |  | The id of the revision to delete

  Declaration:

      procedure delete (
        revision_id	in cr_revisions.revision_id%TYPE
      );

  See Also: | content_revision.new, acs_object.delete

- Procedure: content_revision.index_attributes

  Generates an XML document for insertion into cr_revision_attributes, which is indexed by Intermedia for searching attributes.

  Author: | Karl Goldstein
  Parameters:

  > revision_id: |  | The id of the revision to index

  Declaration:

      procedure index_attributes(
        revision_id IN cr_revisions.revision_id%TYPE
      );

  See Also: | content_revision.new

- Procedure: content_revision.replace

  Parameters:
  Not yet documented
  Declaration:

      procedure replace(
        revision_id number, search varchar2, replace varchar2)
      as language
        java
      name
        'com.arsdigita.content.Regexp.replace(
          int, java.lang.String, java.lang.String
         )';

- Procedure: content_revision.to_html

  Converts a revision uploaded as a binary document to html

  Author: | Karl Goldstein
  Parameters:

  > revision_id: |  | The id of the revision to index

  Declaration:

      procedure to_html (
        revision_id IN cr_revisions.revision_id%TYPE
      );

  Last Modified: $Id: revision.html,v 1.1.1.1 2001/03/13 22:59:26 ben Exp $