5 Designing Basic Asset Types

The AssetMaker utility is available for you to create basic asset types. You also need to create an asset descriptor file and asset table, add subtypes, set association fields, etc., before you migrate the asset types to the management/delivery system for content and marketing teams.

Topics:

5.1 About the AssetMaker Utility

To create basic asset types, the AssetMaker utility carries out several operations in AssetType, SystemInfo, Category, Catalog, and SystemSQL tables using a descriptor file which you’ll create.

Before the AssetMaker utility can begin its work, it needs a descriptor file that defines properties for the new asset type. The term property means both a column in a database table and a field in a WebCenter Sites entry form. So, first define the basic asset type inWebCenter Sites an XML file–asset descriptor file using AssetMaker XML tags.

Your next step is to upload the file to WebCenter Sites and create two items using AssetMaker: a database table for the new asset type, and the WebCenter Sites elements which generate the forms that you and others use when working with assets of the new type (creating, editing, copying, and so on).

This section includes the following topics:

5.1.1 How AssetMaker Works

Creating a new basic asset type using AssetMaker involves the following steps:

  1. Code the asset descriptor file.

    This chapter describes asset descriptor files and coding them. For information about AssetMaker tags, see the Tag Reference for Oracle WebCenter Sites Reference.

  2. Upload the file.

    AssetMaker creates a row in the AssetType table and copies the asset descriptor file to that row.

  3. Create the table.

    When you click the Create Asset Table button, AssetMaker does the following:

    • Parses the asset descriptor file.

    • Creates the primary storage table for assets of that type. The name of the table matches the name of the asset type identified in the asset descriptor file. The data type of each column is defined by statements in the file as well.

      In addition to the columns defined in the asset descriptor file, AssetMaker creates default columns that WebCenter Sites needs to function correctly.

    • Adds a row for the new table to the SystemInfo table.

      All asset tables are object tables so the value in the systable column is set to obj.

      All asset tables have URL columns. So, the value in the defdir column is set to the value that you specified either in the asset descriptor file or in the DefDir field in the Create Asset Table form when you create the asset type.

    • If you have enabled the Add General Category option, Asset Maker adds one row to the Category table for the new asset type and names that category General.

  4. Register the elements.

    AssetMaker does the following:

    • Creates a subdirectory in the ElementCatalog table under OpenMarket/Xcelerate/AssetType directory for the new asset type.

    • Copies elements from the AssetStubCatalog table to the new subdirectory in the ElementCatalog table. These elements render WebCenter Sites forms for working with assets of this type and provide the processing logic for the WebCenter Sites functions.

    • Creates SQL statements that implement searches on individual fields in the search forms. These statements are placed in the SystemSQL table.

When you create, edit, inspect, and so on an asset of this type, AssetMaker parses the asset descriptor file located in the AssetType table, and passes its values to WebCenter Sites so that the forms are specific to the asset type. Statements in the asset descriptor file determine the input types of the fields, specify field length restrictions, and determine whether the field is displayed on search and search results forms.

Note that after you create an asset type, you must enable the asset type on the sites that will use it, create start menu shortcuts, and so on.

The following figure shows a flow chart that summarizes how AssetMaker works, and which database tables are involved when a basic asset type is created.

Figure 5-1 How AssetMaker Works

Description of Figure 5-1 follows
Description of "Figure 5-1 How AssetMaker Works"

5.1.2 Asset Descriptor Files

Using the AssetMaker XML tags, you code asset descriptor files that define the asset types you design for your systems.

This section includes the following topics:

5.1.2.1 About the Asset Descriptor File

An asset descriptor file is a valid XML document in which developers define a basic asset type using AssetMaker tags. An asset descriptor file does the following:

  • Describes the asset type in terms of data structure. It specifies the name of the database table, the names of the columns, the columns data types, and the sizes of the fields on the WebCenter Sites forms.

  • Formats the HTML forms that are displayed by WebCenter Sites when users work with assets of the given type. Formatting an HTML form means naming the fields on the form, displaying the fields in required format (for example, check box, radio button, or drop-down list), accounting for field specifications (such as the number of characters that can be entered in to a text field), and so on.

AssetMaker uses the asset descriptor file to create a database table for the new asset type. When content providers work with assets of the given type (create, edit, and so on), AssetMaker parses the asset descriptor file, using the data in the file to customize the forms that WebCenter Sites displays.

Note:

For reference, sample AssetMaker descriptor code is provided on the WebCenter Sites installation medium, in the Samples folder. The same folder contains the readme.txt file that describes the sample descriptor files.

5.1.2.2 About Format and Syntax

The basic format for every asset descriptor file is shown below. To the right of each AssetMaker tag is a brief description of the tag.

<?xml version="1.0" ?>
<ASSET ...> Names the asset type (storage table) 
<PROPERTIES> Starts the properties specification section
  <PROPERTY ...> Specifies column and field name for the property
    <STORAGE .../> Specifies data type for the column
    <INPUTFORM .../> Specifies field format on New, Edit, Inspect forms
    <SEARCHFORM .../> Specifies field format on Advanced Search form
    <SEARCHRESULTS .../> Specifies which fields are shown in search results
  </PROPERTY>
  <PROPERTY ...>
    <STORAGE .../>
    <INPUTFORM .../>
    <SEARCHFORM .../>
    <SEARCHRESULTS .../>
  </PROPERTY>
  <PROPERTY ...>
...
</PROPERTIES> Ends the properties specification section
</ASSET> Ends the asset descriptor file

Shown next is the syntax of an asset descriptor file, indicating some parameters that an AssetMaker tag can take:

<?xml version="1.0" ?>
<ASSET NAME="assetTypeName" DESCRIPTION=""assetTypeName" ...>
<PROPERTIES>
  <PROPERTY NAME="fieldName1" DESCRIPTION="fieldName1"/>
    <STORAGE TYPE="VARCHAR" LENGTH="36"/>
    <INPUTFORM TYPE="TEXT" DESCRIPTION="fieldName1".../>
    <SEARCHFORM TYPE="TEXT" DESCRIPTION="fieldName1".../>
    <SEARCHRESULTS INCLUDE="TRUE"/>
  </PROPERTY>
  <PROPERTY NAME="fieldName2" DESCRIPTION="fieldName2"/>
    <STORAGE TYPE="INTEGER" LENGTH="4"/>
    <INPUTFORM TYPE="TEXT" DESCRIPTION="fieldName2".../>
    <SEARCHFORM TYPE="TEXT" DESCRIPTION="fieldName2".../>
   <SEARCHRESULTS INCLUDE="TRUE"/>
  </PROPERTY>
...
</PROPERTIES>
</ASSET>

For information about WebCenter Sites tags and their parameters, along with sample code, see the Tag Reference for Oracle WebCenter Sites Reference.

5.1.2.3 About the AssetMaker Tags
  • An asset descriptor file begins with the standard XML version tag:

    <?xml version="1.0"?>

  • The ASSET tag, which follows the XML version tag, names the asset type and therefore its storage table in the WebCenter Sites database. The ASSET tag also sets some behavior and display attributes of assets of that type; for example, the ASSET tag determines what graphical notation designates that a field is required, and whether an asset can be previewed.

    The opening tag <ASSET> is always the first line of code and the closing tag <\ASSET> is always the last line of code in the asset descriptor file. Note that there is only one ASSET tag pair in each asset descriptor file because only one asset type per asset descriptor file can be created.

  • The PROPERTIES tag marks the section of the file that holds the property descriptions. The opening tag <PROPERTIES> is always the second statement in the asset descriptor file. There is only one PROPERTIES tag pair in each asset descriptor file.

    Note:

    The PROPERTIES tag is required in every asset descriptor file, even if no PROPERTY tags are needed.

  • The PROPERTY tags, nested within the PROPERTIES tag pair, specify the columns and fields for assets of this type. Each PROPERTY tag specifies the database name of the column that will hold the value(s) users will enter for this property, and the column's display name (that is, its field name) as it will appear on the form that will be rendered for users who are to work with assets of this type.

  • Nested inside each pair of PROPERTY tags are the following tags:

    • STORAGE: Specifies the data type of the column that is being established by this property. Note that the data type in the STORAGE tag must map to one of the data types that is defined by the properties on the database entry of the futuretense.ini file.

    • INPUTFORM: Specifies the name and format of the field on the New, Edit, and Inspect forms. For example, whether the field is a drop-down list or a check box or a text field. The field's input type must be compatible with the data type of the database column, as specified by the STORAGE statement.

    • SEARCHFORM: Specifies the format of the field (property) when it displays on the Advanced Search form. Omitting the SEARCHFORM statement from the PROPERTY section prevents the field being defined from appearing on the Advanced Search form.

      Setting the TYPE parameter values to Table or Date displays a drop-down list on the Advanced Search form for the asset type, but not on the SimpleSearch form.

    • SEARCHRESULTS: Specifies which fields are displayed in the search results form after a search is run. The field value is also displayed if the INCLUDE parameter is set to true. This tag is optional.

      When modifying a standard field, do not set SEARCHRESULTS to true for name or description.

For information about AssetMaker tags and their parameters, see the Tag Reference for Oracle WebCenter Sites Reference. That section also provides information about dependencies and restrictions among the parameters STORAGE TYPE, INPUTFORM TYPE, and SEARCHFORM TYPE.

5.1.3 Columns in the Asset Type's Database Table

When AssetMaker creates the database table for a new asset type, it creates columns for all the properties defined by the PROPERTY tags in the asset descriptor file, and it creates default columns that are required by WebCenter Sites for its basic functionality. For a list of the default columns in each asset type's table, see Default Columns in the Basic Asset Type Database Table.

This section includes the following topics:

5.1.3.1 The Source Column: A Special Case

All of the asset type tables can also have a source column. WebCenter Sites provides a Source table and a Source form in the Admin node on the General Admin tree. that you use to add the rows to the Source table. You can use this feature to identify where an asset originated. However, unlike the columns listed in the preceding table, the source column is not automatically created when AssetMaker creates the asset type table. To add the source column to your table and have it displayed on your asset forms, you must include a PROPERTY description for it in the asset descriptor file. See Example 5-2.

5.1.3.2 Storage Types for the Columns

The STORAGE TYPE parameter specifies the data type of a column. The data types are defined by the WebCenter Sites database properties located in the wcs_properties.json file.

The following table presents the possible data types for your asset type's table columns.

Table 5-1 STORAGE TYPE Parameter

Type (generic ODBC/JDBC data type) Property

CHAR

cc.char

VARCHAR

cc.varchar

SMALLINT

cc.smallint

INTEGER

cc.integer

BIGINT

cc.bigint

DOUBLE

cc.double

TIMESTAMP

cc.datetime

BINARY

cc.blob

LONGVARCHAR

cc.bigtext

5.1.3.3 Input Types for the Fields

The INPUT TYPE parameter specifies how data can be entered in a field when it is displayed in the WebCenter Sites forms. The following table lists all the input types. Note that the input type for a field must be compatible with the data type of its column.

Table 5-2 INPUT TYPE Parameter

Input TYPE Description

TEXT

A single line of text.

Corresponds to the HTML input type named TEXT.

For the TEXT input type, you are advised to have the same value for the LENGTH attribute of STORAGE and the MAXLENGTH attribute of INPUTFORM. Both LENGTH and MAXLENGTH attribute values represent number of bytes rather than number of characters.

TEXTAREA

A text box, with scroll bars, that accepts multiple lines of text.

Corresponds to the HTML input type named TEXTAREA.

To accommodate large amounts of text in the field, create a text box that displays the contents of a URL column. To do so, you must specify a string for PROPERTY NAME that begins with url and set the STORAGE TYPE to VARCHAR.

When a user clicks Save, the text entered into this kind of field is stored in the file directory specified as the default storage directory for this asset type. You can specify the default storage directory (defdir) in either the asset descriptor file, or in the AssetMaker form when you create the asset type.

Note:

  • You can specify an unlimited size for a url field that is edited using a TEXTAREA field by not specifying a value for the MAXLENGTH parameter.

  • Do not use the following suffixes with a string for PROPERTY NAME that begins with the letters url: _type, _size, _folder, and _file.

UPLOAD

A field that takes a file name (a URL) and presents a Browse button so that you can either enter the path to and name of a file or browse to it and select it.

When you specify that a field is an upload field, set a string for PROPERTY NAME that begins with url and set STORAGE TYPE (the property's data type) to VARCHAR.

You can also use the BLOB storage type for an upload field. In this case, the PROPERTY NAME string does not have to begin with url.

When the user clicks Save, WebCenter Sites uploads the selected file and stores it in the file directory specified as the default storage directory for this asset type. You can specify the default storage directory (defdir) in either the asset descriptor file, or in the AssetMaker form when you upload the file.

Note:

  • The size of a file that is selected in an upload field cannot exceed 30 megabytes.

  • If you specify a string for PROPERTY NAME that begins with the letters url, do not use the following suffixes: _type, _size, _folder, and _file.

SELECT

A field that presents a drop-down list of options that can be selected.

You can either specify the options that are presented in the list or you can specify a query so that the options are selected from the database (or an external table) and presented dynamically.

Corresponds to the HTML input type SELECT.

CHECKBOX

A check box field.

You can specify the names of the check box options or you can specify a query so that the names are selected from the database (or an external table) and presented dynamically. This input type allows the user to select multiple options.

Corresponds to the HTML input type CHECKBOX.

RADIO

A radio button control.

You can either specify the names of the radio options or you can specify a query so that the names are selected from the database (or an external table) and presented dynamically. This input type allows the user to select only one option.

Corresponds to the HTML input type RADIO.

CKEDITOR

A field whose contents you edit by using the CKEditor text editor.

When you specify that a field is a CKEditor field, it is recommended that you make it a URL field. That is, set a string for PROPERTY NAME with the url prefix and set STORAGE TYPE (the property's data type) to VARCHAR.

If you specify a string form PROPERTY NAME that begins with the url prefix, do not use the following suffixes: _type, _size, _folder, and _file.

ELEMENT

Calls an element that you create to display a field on the ContentForm, ContentDetails, or SearchForm forms. The custom element must be found at one of the following locations:

  • For a field on the ContentForm form:

OpenMarket/Xcelerate/AssetType/myAssetType/ ContentForm/fieldname

  • For a field on the ContentDetails form:

OpenMarket/Xcelerate/AssetType/myAssetType/ContentDetails/fieldname

  • For a field on the SearchForm form:

OpenMarket/Xcelerate/AssetType/myAssetType/SearchForm/fieldname

Where myAssetType is the asset type that you are creating the custom field for, and fieldname is the name of the custom field.

An ELEMENT field can have any storage type, including BLOB.

5.1.3.4 Data Types for Standard Asset Fields

You can customize the appearance of the WebCenter Sites standard asset fields. All other changes are conditional on the type of field, as described below:

  • All standard fields. You can change their display names.

  • A standard field that is not a system field. You must not change its data type, with one exception: You can change only the length of the VARCHAR data type.

  • System fields. You must not change the data type (including the length of a VARCHAR type of field).

    The following table lists the data types of standard fields (and indicates whether they are also system fields).

Table 5-3 Data Types for Standard Asset Fields

Standard Field System Field Data Type

ID

Yes

NOT NULL NUMBER(38)

NAME

N/A

NOT NULL VARCHAR(64)

DESCRIPTION

N/A

VARCHAR(128)

TEMPLATE

Yes

VARCHAR(64)

SUBTYPE

N/A

VARCHAR(24)

FILENAME

N/A

VARCHAR(64)

PATH

N/A

VARCHAR(255)

STATUS

Yes

NOT NULL VARCHAR(2)

EXTERNALDOCTYPE

Yes

VARCHAR(64)

URLEXTERNALDOCXML

Yes

VARCHAR(255)

URLEXTERNALDOC

Yes

VARCHAR2(255)

CREATEDBY

Yes

NOT NULL VARCHAR(64)

UPDATEDBY

Yes

NOT NULL VARCHAR(64)

CREATEDDATE

Yes

NOT NULL DATE

UPDATEDDATE

Yes

NOT NULL DATE

STARTDATE

N/A

DATE

ENDDATE

N/A

DATE

5.1.4 Elements and SQL Statements for the Asset Type

After you upload an asset descriptor file, you register the elements. When you register elements, AssetMaker copies elements in the AssetStubElementCatalog table to a directory in the ElementCatalog table for this asset type. Additionally, AssetMaker copies several SQL statements that implement the WebCenter Sites searches on the Simple Search and the Advanced Search forms for assets of this type.

If necessary, you can customize the SQL statements, the asset type-specific elements, or, in some cases, the elements in the AssetStubElementCatalog table. See Customizing the Asset Type Elements (Optional).

Note:

Under no circumstances should you modify any of the other WebCenter Sites elements.

Topics:

5.1.4.1 The Elements

AssetMaker places the elements for your new asset type to the ElementCatalog table according to the following naming convention:

OpenMarket/Xcelerate/AssetType/YourNewAssetType

For example, the elements for the sample asset type ImageFile are located here:

OpenMarket/Xcelerate/AssetType/ImageFile

The following table lists the elements that AssetMaker copies for each asset type.

Table 5-4 AssetMaker Elements

Element Description

ContentForm

Renders the New and Edit forms for assets of this type.

When the function is invoked, AssetMaker uses the INPUTFORM statements in the asset descriptor file to format these forms.

ContentDetails

Formats the Inspect form for assets of this type.

When the function is invoked, AssetMaker uses the INPUTFORM statements in the asset descriptor file to customize these forms.

SimpleSearch

Renders the Simple Search form for assets of this type.

When the function is invoked, AssetMaker uses the SEARCHFORM statements in the asset descriptor file to format these forms.

SearchForm

Formats the Advanced Search form for assets of this type.

When the function is invoked, AssetMaker uses the SEARCHFORM statements in the asset descriptor file to format these forms.

AppendSelectDetails

Builds the SQL queries on the individual fields in the Advanced Search form.

When the Advanced Search form is rendered, AssetMaker uses the SEARCHFORM statements in the asset descriptor file to customize the form.

AppendSelectDetailsSE

Builds the SQL queries on the individual fields in the Advanced Search form when your system is using an external search engine.

When this function is invoked, AssetMaker uses the SEARCHFORM statements in the asset descriptor file to create the SQL queries.

IndexAdd

The IndexAdd and IndexReplace elements establish which fields (columns) are indexed by the search engine when you are using a search engine. By default, only the standard fields are indexed. To index other fields, you must customize these forms. See Customizing the Asset Type Elements (Optional).

IndexReplace

See the description of IndexAdd.

Tile

Formats the Search Results page, a page that lists the assets that meet the search criteria, for assets of this type.

When the page is rendered, AssetMaker uses the SEARCHRESULTS statements in the asset descriptor file to display the results.

LoadTree

Determines how assets of this type appear when they are displayed on any tab in the tree other than the Site Navigation tab.

LoadSiteTree

Determines how assets of this type appear when they are displayed on the Site Navigation node in the Site tree.

PreUpdate

Is called before a function that writes to the database is completed. In other words, before an asset is saved and during the create, edit, delete, or XMLPost functions, this element is called.

This element takes no input from the asset descriptor file. However, you can customize it directly.

PostUpdate

Is called after a function that writes to the database is completed. In other words, after an asset is created, edited, deleted, or imported with XMLPost, this element is called.

You can customize this element.

5.1.4.1.1 About PreUpdate and PostUpdate Elements

Actions or procedures that can be performed on assets are called functions. For example, New, Edit, and Delete are all functions that can be invoked by users of the Admin and Oracle WebCenter Sites: Contributor interfaces to create, edit, and delete assets. Such functions also call the PreUpdate and PostUpdate elements.

PreUpdate and PostUpdate elements are used to contain logic that initiates various operations when the elements are called. The PreUpdate element is called when a function is invoked; the PostUpdate element is called after WebCenter Sites writes asset information to the database. Each element contains a variable whose name and value specify conditions that call the element. To call the element from the Admin interface or from Form Mode of the Contributor interface or the XMLPost utility, name the variable as updatetype. To call the element from Web Mode of the Contributor interface, name the variable as servicesUpdateType. For example, your content managers are working with the Admin interface and their system is configured to import batches of articles from a wire service. You can have the PreUpdate element set the value for the Source field to wirefeed and the value for the Byline field to API just before import occurs if you code these operations in the element and set updatetype=remotepost as the condition under which the element will be called.

Note:

PreUpdate and PostUpdate elements are always called when a WebCenter Sites user invokes the New, Edit, or Delete function in the Admin or Contributor interface, or when assets are imported through XMLPost. Whether operations are performed using the PreUpdate and PostUpdate elements depends on how the elements are coded. By default, they are designed for no action.

PreUpdate and PostUpdate elements are accessible from Explorer, in the following path:

ElementCatalog\OpenMarket\Xcelerate\AssetType

Note:

The PreUpdate element is called twice if a user saves a new or edited asset in the Admin interface:

The first call occurs before the New or Edit form is rendered.The second call occurs after the user clicks Save in the New or Edit form, but WebCenter Sites has not yet written asset information to the database.

The condition above provides the opportunity to perform operations using PreUpdate at one or more points once the New or Edit function is invoked: before the New or Edit form is rendered, before asset information is written to the database, or both, depending on the value of the element's updatetype variable.

The following table defines the values of the updatetype variable:

Table 5-5 Values of the UpdateType Variable

updatetype = Description

setformdefaults

When a user invokes the New function in the Admin interface or in the Form Mode of the Contributor interface.

  • The PreUpdate element is called before the New form is rendered.

  • For PostUpdate, setformdefaults is not a legal value for the updatetype variable.

create

When a user saves a new asset in the Admin interface or in the Form Mode of the Contributor interface:

  • The PreUpdate element is called before the new asset is written to the database.

  • The PostUpdate element is called after the new asset is written to the database.

editfront

When a user invokes the Edit function in the Admin interface or in the Form Mode of the Contributor interface:

  • The PreUpdate element is called before the Edit form is rendered.

  • For PostUpdate, editfront is not a legal value for the UpdateType variable.

edit

When a user saves an edited asset in the Admin interface or in the Form Mode of the Contributor interface:

  • The PreUpdate element is called before the edits are written to the database.

  • The PostUpdate element is called after the edits are written to the database.

delete

When a user deletes an asset from the Admin interface:

  • The PreUpdate element is called before WebCenter Sites deletes the asset.

  • The PostUpdate is performed after WebCenter Sites deletes the asset.

remotepost

When a user invokes the XMLPost function to import an asset:

  • The PreUpdate element is called before the asset is imported.

  • The PostUpdate element is called after the asset is imported.

InSite

When saved from Web Mode, a variable called servicesUpdateType will have create, edit, or delete depending on the user operation.

Table 5-6 defines the values of the servicesUpdateType variable.

The following table defines the values of the servicesUpdateType variable.

Table 5-6 Values of the servicesUpdateType Variable (Contributor interface)

servicesUpdateType = Description

create

When a user saves a new asset in the Contributor interface:

  • The PreUpdate element is called before the new asset is written to the database.

  • The PostUpdate element is called after the new asset is written to the database.

edit

When a user saves an edited asset in the Contributor interface:

  • The PreUpdate element is called before the edits are written to the database.

  • The PostUpdate element is called after the edits are written to the database.

delete

When a user deletes an asset in the Contributor interface:

  • The PreUpdate element is called before WebCenter Sites deletes the asset.

  • The PostUpdate element is called after WebCenter Sites deletes the asset.

5.1.4.2 The SQL Statements

AssetMaker places the SQL statements in the SystemSQL table according to the following naming convention:

OpenMarket/Xcelerate/AssetType/YourNewAssetType

For example, the elements for the sample asset type ImageFile are located here:

OpenMarket/Xcelerate/ImageFile

The following table lists the SQL elements that AssetMaker creates:

Table 5-7 SQL Elements

Statement Description

SelectSummary

A SQL statement that defines the query used in the Simple Search and Advanced Search form for assets of this type.

SelectSummarySE

Not used.

5.2 Before You Begin Creating Basic Asset Types

To be able to create an efficient asset type design, you need to consider many points such as the number of fields, data types, asset associations. Also set up your development system with a CM site and a user Id with appropriate rights.

5.2.1 Planning the Asset Type Design

Be sure to design your asset types on paper before you start coding an asset descriptor file. Consider the following kinds of details:

  • What fields do you need?

    In general, try to minimize the number of fields that you use by organizing the information into useful units. When determining those units, consider both the information you plan to display on your online site and the data-entry needs of the content providers who will enter that data.

  • What is the appropriate data type for each field?

  • For fields with options, how will you supply the options?

    With a static list coded in the asset descriptor file or with a lookup table that holds the valid options?

  • Which WebCenter Sites features will you use to organize or categorize assets of this type?

    For example, source, category, and asset associations. For each one, determine its name and plan how it will be used both on the management system and in the design of your online site.

  • Does the implementation of your site design require assets of this type to use a different default template based on the publishing target that they are published to?

    If so, you will have to use the Subtype feature. Determine the names of the subtypes that you will need for assets of this type.

5.2.2 Setting Up Your Development System

Also before you begin, be sure to set up your development system. For information about any of these preliminary steps, see Administering Oracle WebCenter Sites.

  • Create the appropriate sites.

  • Create a user name for yourself that has administrator rights and enable that user name on all of the sites on your development system. Be sure that the TableEditor ACL is assigned to your user name or you will be unable to create asset types.

    Note:

    Without administrator rights, you do not have access to the Admin node in the General Admin tree, which means that you cannot perform any of the procedures in this chapter. For the sake of convenience, assign the Designer and GeneralAdmin roles to your user name. That way you will have access to all the tabs and all of the existing Start Menu shortcuts for the assets in the sample site.

5.3 Creating Basic Asset Types

You spend less time creating a simple asset type that needs just one descriptor file. For some asset types you can modify the code in the elements that AssetMaker creates, or add a database table to hold information for the dropdown lists.

Creating basic asset types includes these tasks:

5.3.1 Coding the Asset Descriptor File

As described in Asset Descriptor Files, this is the basic format of an asset descriptor file:

<?xml version="1.0" ?>
<ASSET NAME="assetName"...>
<PROPERTIES>
  <PROPERTY.../>
    <STORAGE.../>
    <INPUTFORM.../>
    <SEARCHFORM.../>
    <SEARCHRESULTS.../>
  </PROPERTY>
  <PROPERTY... />
    <STORAGE.../>
    <INPUTFORM.../>
    <SEARCHFORM.../>
    <SEARCHRESULTS.../>
  </PROPERTY>
</PROPERTIES>
</ASSET>

To code your asset descriptor files, see the Tag Reference for Oracle WebCenter Sites Reference and use the tags described in this guide to code the file. Use the native XML editor in Explorer or any other XML editor to code the file.

Note that you can customize the appearance of standard asset fields by including them in your asset descriptor file. Changing a field's storage type is conditional. For example, a system field's storage type must not be changed. For the list of standard fields, their storage types, and allowed changes to storage type, see Data Types for Standard Asset Fields.

This section offers a sample asset descriptor file and several examples about coding specific kinds of properties.

This section includes the following examples:

Example 5-1 Sample Asset Descriptor File: ImageFile.xml

An example of an Asset Descriptor File, ImageFile.xml, follows:

<!-- this is the description of an asset -->
<ASSET NAME="ImageFile" DESCRIPTION="ImageFile"
 MARKERIMAGE="/Xcelerate/data/help16.gif" PROCESSOR="4.0"
 DEFDIR="c:\FutureTense\Storage\ImageFile">

<PROPERTIES>

  <PROPERTY NAME="source" DESCRIPTION="Source">
    <STORAGE TYPE="VARCHAR" LENGTH="24"/>
    <INPUTFORM DESCRIPTION="Source" TYPE="SELECT" TABLENAME="Source"
     OPTIONDESCKEY="description" OPTIONVALUEKEY="source" SOURCETYPE="TABLE"/>
    <SEARCHFORM DESCRIPTION="Source" TYPE="SELECT" TABLENAME="Source"
     OPTIONDESCKEY="description" OPTIONVALUEKEY="source" SOURCETYPE="TABLE"/>
  </PROPERTY>

  <PROPERTY NAME="urlpicture" DESCRIPTION="Image File">
    <STORAGE TYPE="VARCHAR" LENGTH="255"/>
    <INPUTFORM TYPE="UPLOAD" WIDTH="36" REQUIRED="NO" LINKTEXT="Image"/>
  </PROPERTY>

  <PROPERTY NAME="urlthumbnail" DESCRIPTION="Thumbnail File">
    <STORAGE TYPE="VARCHAR" LENGTH="255"/>
    <INPUTFORM TYPE="UPLOAD" WIDTH="36" REQUIRED="NO" LINKTEXT="Image"/>
  </PROPERTY>

  <PROPERTY NAME="mimetype" DESCRIPTION="Mimetype">
    <STORAGE TYPE="VARCHAR" LENGTH="36"/>
    <INPUTFORM TYPE="SELECT" SOURCETYPE="TABLE" TABLENAME="MimeType"
     OPTIONDESCKEY="description" OPTIONVALUEKEY="mimetype"
     SQL="SELECT mimetype, description 
     FROM MimeType 
     WHERE keyword = 'image' 
     AND isdefault = 'y'" 
     INSTRUCTION="Add more options to mimetype table with isdefault=y 
     and keyword=image"/>
    <SEARCHFORM DESCRIPTION="MimeType" TYPE="SELECT" SOURCETYPE="TABLE"
     TABLENAME="MimeType" OPTIONDESCKEY="description" OPTIONVALUEKEY="mimetype"
     SQL="SELECT mimetype, description 
     FROM MimeType 
     WHERE keyword = 'image' 
     AND isdefault = 'y'"/>
  </PROPERTY>

  <PROPERTY NAME="width" DESCRIPTION="Width">
    <STORAGE TYPE="INTEGER" LENGTH="4"/>
    <INPUTFORM TYPE="TEXT" WIDTH="4" MAXLENGTH="4" REQUIRED="NO" DEFAULT=""/>
    <SEARCHFORM DESCRIPTION="Width is" TYPE="TEXT" WIDTH="4" 
     MAXLENGTH="4" VERB="="/>
  </PROPERTY>

  <PROPERTY NAME="height" DESCRIPTION="Height">
    <STORAGE TYPE="INTEGER" LENGTH="4"/>
    <INPUTFORM TYPE="TEXT" WIDTH="4" MAXLENGTH="4" REQUIRED="NO" DEFAULT=""/>
    <SEARCHFORM DESCRIPTION="Height is" TYPE="TEXT" WIDTH="4" 
     MAXLENGTH="4" VERB="="/>
  </PROPERTY>

  <PROPERTY NAME="align" DESCRIPTION="Alignment">
    <STORAGE TYPE="VARCHAR" LENGTH="8"/>
    <INPUTFORM TYPE="SELECT" SOURCETYPE="STRING" 
     OPTIONVALUES="Left,Center,Right" OPTIONDESCRIPTIONS="Left,Center,Right"/>
    <SEARCHFORM DESCRIPTION="Alignment" TYPE="SELECT" SOURCETYPE="STRING"
     OPTIONVALUES="Left,Center,Right" OPTIONDESCRIPTIONS="Left,Center,Right"/>
  </PROPERTY>

  <PROPERTY NAME="artist" DESCRIPTION="Artist">
    <STORAGE TYPE="VARCHAR" LENGTH="64"/>
    <INPUTFORM TYPE="TEXT" WIDTH="36" MAXLENGTH="64" REQUIRED="NO" DEFAULT=""/>
    <SEARCHFORM DESCRIPTION="Artist contains" TYPE="TEXT" 
     WIDTH="36" MAXLENGTH="64"/>
  </PROPERTY>

  <PROPERTY NAME="alttext" DESCRIPTION="Alt Text">
    <STORAGE TYPE="VARCHAR" LENGTH="255"/>
    <INPUTFORM TYPE="TEXT" WIDTH="48" MAXLENGTH="255" REQUIRED="NO" DEFAULT=""/>
    <SEARCHFORM DESCRIPTION="Alt Text contains" TYPE="TEXT" 
     WIDTH="48" MAXLENGTH="255"/>
  </PROPERTY>

  <PROPERTY NAME="keywords" DESCRIPTION="Keywords">
    <STORAGE TYPE="VARCHAR" LENGTH="128"/>
    <INPUTFORM TYPE="TEXT" WIDTH="48" MAXLENGTH="128" REQUIRED="NO" DEFAULT=""/>
    <SEARCHFORM DESCRIPTION="Keywords contain" TYPE="TEXT" 
     WIDTH="48" MAXLENGTH="128"/>
  </PROPERTY>

  <PROPERTY NAME="imagedate" DESCRIPTION="Image date">
    <STORAGE TYPE="TIMESTAMP" LENGTH="8"/>
    <INPUTFORM TYPE="ELEMENT" WIDTH="24" MAXLENGTH="48" REQUIRED="NO" 
     DEFAULT="" INSTRUCTION="Format: yyyy-mm-dd hh:mm"/>
    <SEARCHFORM DESCRIPTION="Image date" TYPE="ELEMENT" 
     WIDTH="48" MAXLENGTH="128"/>
  </PROPERTY>

</PROPERTIES>
</ASSET>

Example 5-2 Adding the Source Column and Field

The source column is not created by default even though WebCenter Sites has a Source feature on the Admin node in the General Admin tree. To use the Source feature on your new asset types, you must include a property statement for the source column and field.

Note the following:

  • STORAGE TYPE must be set to VARCHAR, and LENGTH must be set to 24.

  • INPUTFORM SOURCETYPE must be set to TABLE, and TABLENAME must be set to Source.

For example:

<PROPERTY NAME="source" DESCRIPTION="Source">
  <STORAGE TYPE="VARCHAR" LENGTH="24"/>
  <INPUTFORM TYPE="SELECT" TABLENAME="Source" 
   OPTIONDESCKEY="description" 
   OPTIONVALUEKEY="source" SOURCETYPE="TABLE"/>
  <SEARCHFORM DESCRIPTION="Source" TYPE="SELECT"
   TABLENAME="Source" OPTIONDESCKEY="description"
   OPTIONVALUEKEY="source" SOURCETYPE="TABLE"/>
</PROPERTY>

Example 5-3 Creating a Standard Upload Field

To create an upload field with a Browse button, code the PROPERTY statement as follows:

  1. The string set for PROPERTY NAME must begin with the letters url.

  2. The value for STORAGE TYPE must be set to VARCHAR.

  3. The value for INPUT TYPE must be set to UPLOAD.

Here is a code snippet of an upload field from the ImageFile asset descriptor file:

<PROPERTY NAME="urlpicture" DESCRIPTION="Image File">
  <STORAGE TYPE="VARCHAR" LENGTH="255"/>
  <INPUTFORM TYPE="UPLOAD" WIDTH="36" REQUIRED="NO" LINKTEXT="Image"/>
</PROPERTY>

Note:

The size of a file that you can select in an upload field is limited to 1024 megabytes.

Example 5-4 Creating an Upload Field with a Text Box

To create an upload field with a text box that you can enter the text in (rather than with a Browse button that you use to select a file), code the PROPERTY statement as follows:

  1. The string set for PROPERTY NAME must begin with the letters url.

  2. The value for STORAGE TYPE must be set to VARCHAR.

  3. The value for INPUT TYPE must be set to TEXTAREA.

The following code snippet creates a text area field for a url column:

<PROPERTY NAME="urlbody" DESCRIPTION="Article Body">
  <STORAGE TYPE="VARCHAR" LENGTH="256"/>
  <INPUTFORM TYPE="TEXTAREA" WIDTH="400" HEIGHT="100" REQUIRED="YES"/>
</PROPERTY>

Example 5-5 Creating an Upload Field with a CKEditor

To create a CKEditor field, code the property statement as follows:

  1. The PROPERTY NAME must begin with the letters url. Therefore, use a URL column for the field, otherwise the field will be too small.

  2. The value for STORAGE TYPE must be set to VARCHAR.

  3. The value for INPUT TYPE must be set to CKEDITOR.

<PROPERTY NAME="urlbody" DESCRIPTION="Body">
  <STORAGE TYPE="VARCHAR" LENGTH="50"/>
  <INPUTFORM TYPE="CKEDITOR" WIDTH="300" HEIGHT="300" REQUIRED="YES" 
   INSTRUCTION="Be concise! No more than 3 paragraphs."/>
</PROPERTY>

The length of the type VARCHAR is the length of the path to the file where the data is stored. This is typically less than 100. An excessively large length (for example, 5000) causes issues with data storage as the database will store the data as a CLOB. And the URL field will be corrupted because the data would be stored in the database rather than the file.

Example 5-6 Creating an Upload Field That Uploads a Binary File

The following code creates a field where you can upload a blob. Not specifying MIMETYPE will prevent you from viewing the blob from the Edit and Inspect forms.

Code the property statements as follows:
  • The string set for PROPERTY NAME must not begin with the letters url.

  • The value for STORAGE TYPE must be set to BINARY.

<PROPERTY NAME="type_binary" DESCRIPTION="Binary">
  <STORAGE TYPE="BINARY"/>
  <INPUTFORM TYPE="UPLOAD" 
   WIDTH="24" MAXLENGTH="64"
   MIMETYPE="application/msword" 
   LINKTEXT="Edit with Microsoft Word" 
   INSTRUCTION="maps to cc.blob"/>
</PROPERTY>

Consider the following about Upload fields:

  • For an Upload field whose PROPERTY NAME starts with the letters url, only the file system path of the uploaded file is stored in the database. So, in this case, STORAGE TYPE must be set to VARCHAR.

  • For an Upload field whose PROPERTY NAME doesn’t start with the letters url, the uploaded file’s data resides in the database in BINARY format. So, in this case STORAGE TYPE must be set to BINARY.

Example 5-7 Enabling path, filename, startdate, and enddate

The path, filename, startdate, and enddate columns are special cases.

AssetMaker creates columns for path, filename, startdate, and enddate without requiring a PROPERTY statement for them. However, while these columns exist, their fields do not appear on your asset forms unless you include a PROPERTY statement for them in the asset descriptor file.

Note the following about these columns:

  • path: The STORAGE TYPE must be set to VARCHAR and LENGTH must be set to 255.

  • filename: The STORAGE TYPE must be set to VARCHAR and LENGTH must be set to 128.

  • startdate: The STORAGE TYPE must be set to TIMESTAMP.

  • enddate: The STORAGE TYPE must be set to TIMESTAMP.

    Note:

    If you include one of these standard columns in your asset descriptor file but your storage type does not match the one specified in this list, AssetMaker cannot create the asset type.

For example:

<PROPERTY NAME="path" DESCRIPTION="Path">
  <STORAGE TYPE="VARCHAR" LENGTH="255"/>
  <INPUTFORM DESCRIPTION="Path" TYPE="TEXT" LENGTH="255"/>
</PROPERTY>

Example 5-8 Using a Query to Obtain Options for a Drop-Down List

When the INPUTFORM TYPE of your property is SELECT, you can have WebCenter Sites populate the drop-down list for the select field with a static list of items that you provide with the OPTIONDESCRIPTIONS parameter, or with a list of items that WebCenter Sites obtains, dynamically, from a database table.

Another example of a select field that populates its drop-down list dynamically from a table is the Mimetype field on the imagefile forms, which queries the MimeType table for its options. Here's the code:

<PROPERTY NAME="mimetype" DESCRIPTION="Mimetype">

  <STORAGE TYPE="VARCHAR" LENGTH="36"/>
  <INPUTFORM TYPE="SELECT" SOURCETYPE="TABLE"
   TABLENAME="mimetype" OPTIONDESCKEY="description" 
   OPTIONVALUEKEY="mimetype" SQL="SELECT mimetype, description
   FROM mimetype 
   WHERE keyword = 'image' 
   AND isdefault = 'y'" 
   INSTRUCTION="Add more options to mimetype table 
   with isdefault=y and keyword=image"/>

  <SEARCHFORM DESCRIPTION="Mimetype" TYPE="SELECT"
   SOURCETYPE="TABLE" TABLENAME="mimetype"
   OPTIONDESCKEY="description" OPTIONVALUEKEY="mimetype"
   SQL="SELECT mimetype, description 
   FROM mimetype 
   WHERE keyword ='image' 
   AND isdefault = 'y'"/>

</PROPERTY>

This example shows a field that not only selects items from a database table, but, through an additional SQL query, further restricts which items are returned from that table, as well.

Example 5-9 Using a Query to Obtain Labels for Radio Buttons

Use RADIO as the INPUTFORM TYPE of your property to input the label for each radio button using a static list of items that you provide with the OPTIONDESCRIPTIONS parameter, or with a list of items that WebCenter Sites obtains, dynamically, from a database table.

The following sample code creates radio buttons with labels drawn from the CreditCard table:

<PROPERTY NAME="sqlrbcc" DESCRIPTION="SQL RB Credit Card">
  <STORAGE TYPE="VARCHAR" LENGTH="4"/>
  <INPUTFORM TYPE="RADIO" SOURCETYPE="TABLE" TABLENAME="CreditCard"
   RBVALUEKEY="ccvalue" RBDESCKEY="ccdescription" />
  <SEARCHFORM TYPE="SELECT" DESCRIPTION="Credit Card:" SOURCETYPE="TABLE"
   TABLENAME="CreditCard" OPTIONVALUEKEY="ccvalue" OPTIONDESCKEY="ccdescription"
   SQL="SELECT ccvalue,ccdescription 
   FROM CreditCard ORDER BY ccdescription"/>
</PROPERTY>

Example 5-10 Creating a Field with the ELEMENT Input Type

To display the fields as you want them on your asset forms, you can call custom code using the ELEMENT input type. Use this method to create asset fields, or to change the appearance of standard asset fields, though you cannot modify the storage type of a standard asset field.

An ELEMENT field can have any storage type, including BLOB. When you set a field's input type to ELEMENT, WebCenter Sites calls a custom element to display the field. The custom element must be found at one of the following locations:

For a field on the ContentForm form:

OpenMarket/Xcelerate/AssetType/myAssetType/ContentForm/fieldname

For a field on the ContentDetails form:

OpenMarket/Xcelerate/AssetType/myAssetType/ContentDetails/fieldname

For a field on the SearchForm form:

OpenMarket/Xcelerate/AssetType/myAssetType/SearchForm/fieldname

Note that myAssetType is the asset type that you are creating the custom field for, and fieldname is the name of the custom field.

The following excerpt from an asset descriptor file uses the ELEMENT input type:

<PROPERTY NAME="imagedate" DESCRIPTION="Image date">
  <STORAGE TYPE="TIMESTAMP" LENGTH="8"/>
  <INPUTFORM TYPE="ELEMENT" WIDTH="24" MAXLENGTH="48" REQUIRED="NO" DEFAULT=""
   INSTRUCTION="Format: yyyy-mm-dd hh:mm"/>
  <SEARCHFORM DESCRIPTION="Image date" TYPE="ELEMENT" 
   WIDTH="48" MAXLENGTH="128"/>
</PROPERTY>

Note that the input form uses a customized field, but the search form and content details forms display default fields.

The following code excerpt is the element that the descriptor file calls:

<!-- OpenMarket/Xcelerate/AssetType/ImageFile/ContentForm/imagedate
-
- INPUT
- Variables.AssetType
Variables.fieldname 
Variables.fieldvalue- default or value for this field
Variables.datatype - from STORAGE tag in ADF for this field
Variables.helpimage - help icon 
Variables.alttext - help text from INPUT tag in ADF
Other fields from input tag are in:
Variables.assetmaker/property/Variables.fieldname/inputform/[tag attribute]
- field name used in form should be Variables.AssetType:Variables.fieldname

- OUTPUT
-
-->
Enter date in the format yyyy-mm-dd hh:mm:ss<br/>

<setvar 
 NAME="inputfieldsize"
 VALUE="Variables.assetmaker/property/Variables.fieldname/inputform/width"/>

<callelement NAME="OpenMarket/Xcelerate/Scripts/FormatDate"/>

<INPUT TYPE="text" SIZE="Variables.inputfieldsize"
 NAME="Variables.AssetType:Variables.fieldname" 
 VALUE="Variables.fieldvalue" 
 REPLACEALL="Variables.inputfieldsize,Variables.fieldvalue,Variables.fieldname,
 Variables.AssetType"onChange="padDate(this.form.elements['Variables.AssetType:
 Variables.fieldname'].value,this,'Variables.AssetType:Variables.fieldname'
 );"/>

</FTCS>

Note that you can customize as many fields as you want using the ELEMENT input type, but you must write a separate element for each field.

5.3.2 Uploading the Asset Descriptor File to WebCenter Sites

After you have coded the asset descriptor file for your asset type, use AssetMaker to upload it and register the new elements:

  1. Open the Admin interface.
  2. Select the General Admin tree and then expand the Admin node.
  3. Expand AssetMaker and click Add New.

    The Add New AssetMaker Asset Type form opens.

  4. In the Name field, enter the name of the new asset type. The string that you enter into this field must exactly match the string specified by the ASSET NAME parameter in the asset descriptor file that you are going to upload.
  5. In the Descriptor File field, click Browse and select the asset descriptor file.
  6. Click Save.

    AssetMaker enters the file into the AssetType table (that is, it uploads the asset descriptor file to the default storage directory for the AssetType table), and then opens the Asset Type form.

    The Asset Type form opens.

5.3.3 Creating the Asset Table

This step continues from step 6 of Uploading the Asset Descriptor File to WebCenter Sites.

  1. Select Create Asset Table.
  2. In the DefDir field, examine the value and change it if necessary. AssetMaker reads this value from the asset descriptor file. You must enter a value in this field if either of the following conditions exist:
    • If you did not provide a value with the DEFDIR parameter for the ASSET tag in the asset descriptor.

    • To change the default storage directory, which is typical when you are migrating the asset type to another system.

    Enable the Add General Category option. AssetMaker adds one row to the Category table for the new asset type and names that category General.

  3. Click Create Asset Table.

    AssetMaker creates the table, and it displays a confirmation.

  4. Select Register Asset Elements, and then click Register Asset Elements.

    AssetMaker copies the elements from the AssetStubElementCatalog table to the asset type's directory in the ElementCatalog table and copies the SQL statements in the SystemSQL table.

    When it is finished, it displays a confirmation.

5.3.4 Configuring the Asset Type

When AssetMaker created the new asset type (in Uploading the Asset Descriptor File to WebCenter Sites), it also created an icon and administrative forms for configuring the new asset type, located in the Admin node on the General Admin tree.

To configure the asset type:

  1. In the General Admin tree, expand the Admin node and then expand the Asset Types icon.
  2. Under Asset Types, select your new asset type. If you do not see it in the list, right-click and choose Refresh from the context menu, and then choose your new asset type.
  3. Click Edit.

    The Edit Asset Type form opens.

    Figure 5-3 Edit Asset Type Form

    Description of Figure 5-3 follows
    Description of "Figure 5-3 Edit Asset Type Form"
  4. (Optional) In the Description field, change the value, if necessary. The text in this field is the name that WebCenter Sites uses for this asset type on the forms and lists in the WebCenter Sites interface. By default, description is set to the value of the ASSET DESCRIPTION statement in the asset descriptor file.
  5. (Optional) In the Plural Form field, change the value, if necessary. The text in this field is the text that WebCenter Sites uses in the Admin interface when it is appropriate to refer to the asset type in the plural. By default, Plural Form is set to the value of the ASSET DESCRIPTION statement in the asset descriptor file plus the letter "s." You can also specify your own plural form in the asset descriptor file by setting the value of the ASSET tag's PLURAL parameter.
  6. (Optional) In the Can Be a Child Asset field, change the value, if necessary. By default, this field is set to True, which means that this asset type can be the child asset type in an association field for another asset type. Its name displays in the list of asset types in the Child Asset Field on the Add New Association forms.
  7. (Optional) In the Use Dimensions field, change the value, if necessary. By default, this field is set to True, which means that this asset type supports the creation of multi-lingual content.
  8. Click Save.

5.3.5 Enabling the Asset Type on Your Site

Before you can examine the forms that the new elements render for the asset type, you must enable the asset on the site (or sites) that you are working with and create a simple start menu item for it.

For instructions on how to enable your asset types and create start menu items for them, see Administering Oracle WebCenter Sites.

5.3.6 Fine-Tuning the Asset Descriptor File

Create a new asset of your new type and examine the New, Edit, Inspect, and Search forms. (To create a new asset of this type, click New on the toolbar and select the start menu shortcut that you created in the preceding procedure.)

After you examine the forms, you might have to modify the asset descriptor file.

You can make any of the following changes with relatively few steps:

  • Re-ordering the fields that appear on the WebCenter Sites forms for the asset type.

  • Changing the name of a field (that is, the value of PROPERTY DESCRIPTION).

  • Changing anything in an INPUTFORM, SEARCHFORM, or SEARCHRESULTS statement.

To make any of the changes in the preceding list, complete the following steps:

  1. Use Explorer to open and modify the asset descriptor file that you uploaded in Uploading the Asset Descriptor File to WebCenter Sites.
  2. Save your changes.
  3. Re-register the elements for the asset type.

You cannot change the schema of the asset type's database table after it is created. The following are the schema changes:

  • Changing the name of a column (the NAME parameter in an existing PROPERTY statement).

  • Changing the data type of the column (the STORAGE TYPE or LENGTH in an existing PROPERTY statement).

  • Adding a new property (new PROPERTY statement), which adds a new column to the table.

  • Deleting a property (an existing PROPERTY statement), which deletes a column from the table.

Therefore, to make any of the changes in the preceding list, you must first delete the asset type, modify the asset descriptor file, and then create the asset type again.

Note that customizing the elements that AssetMaker copied from the AssetStubElementCatalog table to the asset type's directory in the ElementCatalog table allows for changes to be overwritten at re-registration of elements.

5.3.7 Customizing the Asset Type Elements (Optional)

The following are the ways to customize asset type elements on your content management system:

  • For changes specific to a certain asset type, modify the elements for that asset type in the ElementCatalog table, using Explorer. See About PreUpdate and PostUpdate Elements.

  • To make the same modifications for assets of all types, modify the source elements in the AssetStubElementCatalog table, using Explorer, before you create your asset types. That way you will have to customize only once.

Note:

Although customizing source elements in the AssetStubElementCatalog table might be necessary, it is not supported. If you plan to customize a stub element, consider that it will be overwritten under the following conditions:

  • Changing the stub elements requires you to re-register all of the asset elements that must take the new changes. When you re-register asset elements, AssetMaker moves new copies of the elements from the AssetStubElementCatalog table to the asset type's directory in the ElementCatalog table (the path is ElementCatalog\OpenMarket\Xcelerate\AssetType) and in the process overwrites the existing elements. Elements that you customized in the AssetType directory will be overwritten.

  • The WebCenter Sites upgrade process typically installs new source elements in the AssetStubElementCatalog table. Code changes in the stub elements are overwritten when you re-register your asset types after upgrade.

Be meticulous about tracking all of your customizations at all times. That way you can re-create your work if necessary.

For more information about the asset type elements you can modify, see The Elements.

5.3.8 Adding Subtypes (Optional)

A subtype is a subclass of the basic asset type based on how that asset is rendered. Use subtypes to define a separate default approval template for an asset of that type and subtype on each publishing target.

Follow these steps to create a subtype:

  1. In the General Admin tree, expand the Admin node, and then expand the Asset Types option.
  2. Under the Asset Types option, select the asset type that you want to create subtypes for.
  3. Select the Subtypes option.

    The Subtypes form opens.

    Figure 5-4 Subtypes for Asset Type Dialog

    Description of Figure 5-4 follows
    Description of "Figure 5-4 Subtypes for Asset Type Dialog"
  4. Click Add New Subtype.
  5. In the Name column of the next form, enter the name of the subtype.
  6. In the corresponding field of the Sites column, select the names of the sites that need this subtype.
  7. Repeat these steps for up to five subtypes.
  8. Click Save.

5.3.9 Configuring Association Fields (Optional)

Associations are assettype-specific relationships that describe parent-child relationships or links between individual assets or asset sub-types. Associations are described in The Basic Asset Model.

When you code your template elements, you use the names of these relationships to identify individual assets or sub-types, without having to refer to the object by its name. For example, in a site that associates imagefile assets with article assets, the template elements should be coded to extract an associated imagefile asset by the name of the association rather than the name of the asset. This enables the template to display another imagefile for an article without you having to re-code the template.

Associations are represented as fields in the asset forms. These fields are not created from an asset descriptor file. Instead, you use the Asset Associations forms under the Admin node in the General Admin tree.

To add an association field:

  1. In the General Admin tree, expand the Admin node, and then expand Asset Types.
  2. Under the Asset Types option, select the asset type that you want to create associations for.
  3. Under the asset type you selected, select Asset Associations and then Add New.

    The Add New Association form opens.

    Figure 5-5 Add New Association Dialog

    Description of Figure 5-5 follows
    Description of "Figure 5-5 Add New Association Dialog"
  4. In the Name field, enter the name of the association field, without using spaces, decimal points, or punctuation marks.
  5. In the Description field, enter a short description of the field. WebCenter Sites uses the text entered into this field as the name of the field when it is displayed on the new asset form.
  6. In the Child Asset field, select the kind of asset type that will appear in this field. (It is called the Child Asset field because associations create parent-child relationships between assets.) You cannot specify the template or the page asset type in this field.
  7. In the Subtypes field, select the subtype or subtypes for this association by highlighting them. To select multiple subtypes, press the Control key while you click your selection with your mouse.
  8. In the Mirror Dependency Type section, select a suitable option for this asset association. By default, it is set to Exists. The dependency type specified here is used by the approval system when your publishing method is Mirror to Server.
  9. Click Add New Association.

    WebCenter Sites creates a row in the Association table for this association. The name used in the row is the text you entered in the Name field in step 4.

5.3.10 Configuring Categories (Optional)

Use categories to organize your asset types according to some convention that works for your site design. Although all basic asset types have a Category field (column) by default, it is not a required field and you do not have to use it.

To add a category:

  1. Under the Admin node, select Asset Types.
  2. For the Asset Type option, select the asset type for which you want to create categories. For example, select Article.
  3. Under that asset type, select Categories and then Add New.

    The Add New Category form opens.

    Figure 5-6 Add New Category Dialog

    Description of Figure 5-6 follows
    Description of "Figure 5-6 Add New Category Dialog"
  4. In the Description field, enter a short description of the category. WebCenter Sites uses the text that you enter in this field in the site tree and in the drop-down list for the Category field on the forms for assets of this type.
  5. In the Category Code field, enter a two-character code for your new category.
  6. Click Add.
  7. Repeat steps 2 through 6, as needed, to finish creating the categories for this asset type.

The categories you created now appear in the drop-down lists in the Category fields when creating new assets or editing assets.

5.3.11 Adding Mimetypes (Conditional)

The MimeType table holds mimetype codes that can be displayed in MimeType fields. You must add mimetypes for your asset if you reference the MimeType table in your asset descriptor file. For example, both the imagefile and stylesheet asset types have upload fields with Browse buttons next to them. After you select a file in the upload field, you specify the mimetype of the file you selected from the Mimetype drop-down list.

The Mimetype fields for the imagefile and stylesheet asset types query the MimeType table for mimetype codes based on the keyword column:

  • Mimetype codes with their keyword set to stylesheet appear in the drop-down list of the Mimetype field in the Stylesheet form.

  • Mimetype codes with their keyword set to image appear in the drop-down list of the Mimetype field in the ImageFile form.

By default, stylesheet files can be CSS files and imagefile files can be GIF or JPEG files. You can add mimetype codes for these asset types, for your own custom asset types, or for any other reason.

To add mime types to a Mimetype drop-down list:

  1. Open Explorer.
  2. Expand the MimeType table.
  3. Do one of the following:
    • To add a mimetype for the imagefile asset type, select image in the MimeType table.

    • To add a mimetype for the stylesheet asset type, select text in the MimeType table.

    • To add a mimetype for a custom asset type with an upload field or for any other reason, select the appropriate location in the MimeType table.

  4. Right-click in the frame on the right and then choose New from the drop-down list.

    Explorer creates a new row in the table.

  5. In the mimetype field, enter the name of the mimetype. For example: XSL.
  6. In the extension field, enter the extension for mime types of this type. For example: .xml.
  7. In the Description field, enter a short description of this mimetype.
  8. In the isdefault field, do one of the following:
    • To specify multiple extensions for the same mimetype, enter n. For example, if a mimetype named JPG has .jpg and .jpeg extensions, set isdefault to n.

    • If this is the only extension for the mimetype, enter y.

  9. In the Keyword field, do one of the following:
    • To add a mimetype for the imagefile asset type, enter image.

    • To add a mimetype for the stylesheet asset type, enter stylesheet.

    • To add a mimetype for a custom asset type with an upload field or for any other reason, enter the appropriate keyword.

  10. Select File and then Save all.

    Explorer saves the row.

    A mimetype code, if added with the keyword of image, is now displayed in the Mimetype field of the ImageFile form. A mimetype code that was added with the keyword of stylesheet is now displayed in the Mimetype field of the Stylesheet form.

5.3.12 Editing Search Elements to Enable Indexed Search (Optional)

WebCenter Sites and Oracle WebCenter Sites: Engage have its own database SQL search mechanism that runs the Simple and Advanced searches. However, you can set up your management system to one of the supported third-party search engines instead. For configuration information, see Administering Oracle WebCenter Sites.

When you are using a search engine on your management system, each asset is indexed when it is saved after being created or edited. By default, only the default fields are indexed (for a list, see Default Columns in the Basic Asset Type Database Table). To index the fields that you created with PROPERTY statements in your asset descriptor file, add statements for them in the following elements:

  • OpenMarketXcelerate/AssetType/YourAssetType/IndexAdd.xml

  • OpenMarketXcelerate/AssetType/YourAssetType/IndexReplace.xml

To add the asset type's custom fields to these elements, use the WebCenter Sites INDEX tags and follow the convention illustrated in these elements.

5.3.13 Creating and Assigning Asset Type Icons (Contributor Interface Only)

Create and assign the icon that will represent the asset type in the Contributor interface's navigation trees (Site Tree, Content Tree and My Work tree). Icons can be of any type of image file (for example, PNG, GIF, and so on). In this example, an image file of type PNG is created.

  1. Create an image no larger than 20x20 pixels representing the asset type.
  2. Name the file using the syntax assetType.png. The file name determines the asset type for which the icon will be displayed. The name is case-sensitive.
  3. Place the file in the following directory:

    <cs_app_dir>/Xcelerate/OMTree/TreeImages/AssetTypes/

    where <cs_app_dir> is the directory of the deployed WebCenter Sites application on your application server.

  4. Restart your application server for the icons to appear in the Contributor interface (Site tree, Content tree, and My Work tree).

5.3.14 Coding Templates for the Asset Type

Creating your asset types and coding the templates for assets of that types is an iterative process.

  • Although you have to create asset types before you can create templates for assets of that type, it is likely that you will discover areas that need refinement in your data design only after you have coded a template and tested the code.

    See Coding Elements for Templates and CSElements.

5.3.15 Moving the Asset Types to Other Systems

When you have finished creating all of your new asset types (including creating templates for them), you need to move them to other systems.

  • Migrate the asset types to the management and delivery systems.

    System administrators will then configure the asset types for the management system. They will enable revision tracking where appropriate, create workflow processes, create start menu shortcuts, and so on.

5.4 Deleting Basic Asset Types

You can either delete components of the asset type that you select or all traces of the asset type from the database.

The asset type components are:

  • The database table and all the data in it.

  • The elements in the ElementCatalog table.

  • The SQL statements in the SystemSQL table.

  • The row in the AssetType table.

  • Any rows in the Association table (optional).

  • Any rows in the Category table (optional).

  • Any rows in the AssetPublication table.

  • Any rows in the AssetRelationTree table.

To delete an asset type that you created with AssetMaker:

  1. Open the Admin interface.
  2. Select the General Admin tree and then expand the Admin node.
  3. Expand AssetMaker and then select the asset type that you want to delete.

    The Asset Type form opens.

  4. Select the Delete Asset option and click Submit.

    WebCenter Sites displays a confirmation message.

  5. Click OK.