15 Designing Basic Asset Types

As discussed in Chapter 11, "Data Design: The Asset Models," the data model for basic asset types is one database table per asset type. Each asset of that type is stored in that table.

You create new basic asset types with the AssetMaker utility. Typically you create them on a development system and then, when they are ready, you migrate your work from the development system to the management and delivery systems.

This chapter contains the following sections:

15.1 The AssetMaker Utility

AssetMaker is the utility that you use to create new basic asset types.

Your first step is to define the basic asset type outside WebCenter Sites by coding an xml file called an asset descriptor file, using AssetMaker XML tags. The asset descriptor file 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.

Your next step is to upload the file to WebCenter Sites and use AssetMaker to create two items: a database table for the new asset type, and the WebCenter Sites elements which generate the forms that you and others will use when working with assets of the new type (creating, editing, copying, and so on). Figure 15-1 shows the relationship of a database table to a form (a content-entry form, in this example) and how columns are interpreted as fields when the form is rendered.

This section contains the following topics:

15.1.1 How AssetMaker Works

Using AssetMaker to create a new basic asset type involves four general steps:

  1. Code the asset descriptor file.

    This chapter describes asset descriptor files and coding them. The Oracle Fusion Middleware WebCenter Sites Tag Reference includes information that describes all of the AssetMaker tags.

  2. Upload the file.

    When you upload the asset descriptor 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 checked 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.

    When you 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 use WebCenter Sites to work on an asset of this type (create, edit, inspect, and so on), AssetMaker parses the asset descriptor file, which is now 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, there are several configuration steps to complete before you can use it; for example, enabling the asset type on the sites that need to use the asset type, creating Start Menu shortcuts, and so on.

The flow chart in Figure 15-2 summarizes how AssetMaker works, and which database tables are involved when a basic asset type is created.

Figure 15-1 Asset Types: Database Tables and WebCenter Sites Forms

Description of Figure 15-1 follows
Description of "Figure 15-1 Asset Types: Database Tables and WebCenter Sites Forms"

Figure 15-2 How AssetMaker Works

Description of Figure 15-2 follows
Description of "Figure 15-2 How AssetMaker Works"

15.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 contains the following topics:

15.1.2.1 What Is an Asset Descriptor File?

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

  • 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.

15.1.2.2 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 of the 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>

An overview of the tags in the asset descriptor file is given in this section of the guide. Detailed information about the tags and their parameters, along with sample code, is given in the Oracle Fusion Middleware WebCenter Sites Tag Reference.

15.1.2.3 Overview of 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 of the 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 (i.e., 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 tab of the futuretense.ini file.

    • INPUTFORM: specifies the name and format of the field on the New, Edit, and Inspect forms. For example: Is the field 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 appears on the Advanced Search form. If the SEARCHFORM statement is omitted from the PROPERTY section, the field being defined does not appear on the Advanced Search form.

      Note that if the value of the TYPE parameter is Table or Date, a drop-down list will appear 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.)

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

For detailed information about these tags and their parameters, see the "AssetMaker Tags" section of the Oracle Fusion Middleware WebCenter Sites Tag Reference. That section also provides information about dependencies and restrictions among the parameters STORAGE TYPE, INPUTFORM TYPE, and SEARCHFORM TYPE.

15.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 Section 11.2.4.2, "Default Columns in the Basic Asset Type Database Table."

This section contains the following topics:

15.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 on the Admin tab that you use to add the rows to the Source table. You can use this feature to identify where an asset originated. The Burlington Financial sample site, for example, uses Source to identify which wire feed service provided an article asset.

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. For an example, see Section 15.2.3.2, "Example: Adding the Source Column and Field."

15.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 futuretense.ini file.

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

Table 15-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

BLOB

cc.blob

LONGVARCHAR

cc.bigtext


15.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 15-2 INPUT TYPE Parameter

Input TYPE Description

TEXT

A single line of text.

Corresponds to the HTML input type named TEXT.

TEXTAREA

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

Corresponds to the HTML input type named TEXTAREA.

If you expect large amounts of text to be entered in the field, it is a good idea to 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 via a TEXTAREA field by not specifying a value for the MAXLENGTH parameter.

  • If you are specifying a string for PROPERTY NAME that begins with the letters url, do not use the following suffixes: _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 are specifying 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 more than one option.

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.

Note that if you are specifying 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.


15.1.3.4 Data Types for Standard Asset Fields

You can customize the appearance of WebCenter Sites's 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: If the data type is VARCHAR, you can change only its length.

  • 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 15-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


15.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.

Note:

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

For information about customizing your elements, see Section 15.2.9, "Step 7: (Optional) Customize the Asset Type Elements."

This section contains the following topics:

15.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 15-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. If you want other fields indexed, you must customize these forms. For more information, see Section 15.2.9, "Step 7: (Optional) Customize the Asset Type Elements."

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 Plan tab.

LoadSiteTree

Determines how assets of this type appear when they are displayed on the Site Plan tab.

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.


15.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 15-5 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.


15.2 Creating Basic Asset Types

The length of time that it takes you to create a new asset type can range widely depending on the complexity of your asset type.

A simple asset type might require you to code one simple asset descriptor file and then upload it. A more complicated asset type might require you to modify the code in the elements that AssetMaker creates for your asset type or to add a database table to hold information that you want displayed in a drop-down list.

This section contains the following topics:

15.2.1 Overview of Creating and Configuring a New Asset Type

Following is an overview of the process for creating and configuring a new asset type. This chapter describes each of the steps, except as noted:

  1. Code an asset descriptor file. See Section 15.2.3, "Step 1: Code the Asset Descriptor File."

  2. Upload the asset descriptor file, using AssetMaker in WebCenter Sites's Admin tab. See Section 15.2.4, "Step 2: Upload the Asset Descriptor File to WebCenter Sites."

  3. Create the database table and register the asset type elements by copying the asset type elements from the AssetStubElementCatalog table to the appropriate directory in the ElementCatalog table. See Section 15.2.5, "Step 3: Create the Asset Table."

  4. Configure the asset type. See Section 15.2.6, "Step 4: Configure the Asset Type."

  5. Enable the asset type for the site that you are using to develop assets on and create a Start Menu shortcut so that you can work with the asset type. See Section 15.2.7, "Step 5: Enable the Asset Type on Your Site."

  6. Examine the New, Edit, Inspect, Search, and Search Results forms. If necessary, fine-tune the asset descriptor file, and re-register the asset type elements. See Section 15.2.8, "Step 6: Fine-Tune the Asset Descriptor File."

  7. (Optional) If necessary, customize the asset type elements. See Section 15.2.9, "Step 7: (Optional) Customize the Asset Type Elements."

  8. (Optional) Add Subtype entries for the new asset type. See Section 15.2.10, "Step 8: (Optional) Configure Subtypes."

  9. (Optional) Create asset Association fields for the new asset type. See Section 15.2.11, "Step 9: (Optional) Configure Association Fields."

  10. (Optional) Add Category entries for the new asset type. See Section 15.2.12, "Step 10: (Optional) Configure Categories."

  11. (Optional) Add Source entries for the new asset type. See Section 15.2.13, "Step 11: (Optional) Configure Sources."

  12. (Optional) Add Mimetypes for the new asset type. See Section 15.2.14, "Step 12: (Conditional) Add Mimetypes."

  13. (Optional) If you are using a search engine rather than the WebCenter Sites database search utility to perform the logic behind the search forms and you want to use it on your new asset type, edit your search elements to enable indexed searching. See Section 15.2.15, "Step 13: (Optional) Edit Search Elements to Enable Indexed Search."

  14. 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). See Section 15.2.16, "Step 14: Create and Assign Asset Type Icons (Contributor Interface Only)."

  15. Code templates for assets of this type. See Section 15.2.17, "Step 15: Code Templates for the Asset Type" and Chapter 28, "Coding Elements for Templates and CSElements."

  16. Move the asset types to the other systems, management and delivery. See Section 15.2.18, "Step 16: Move the Asset Types to Other Systems." This allows your administrator to complete the final steps in creating the asset type, including setting up workflow and creating start menu items.

15.2.2 Before You Begin

Before you begin coding your asset descriptor files, you must plan your design and set up your development system, as described in the following sections.

This section contains the following topics:

15.2.2.1 Plan 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 need to use the Subtype feature. Determine the names of the subtypes that you will need for assets of this type.

15.2.2.2 Set 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 the Oracle Fusion Middleware WebCenter Sites Administrator's Guide.

  • 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 new asset types.)

    Note:

    Without administrator rights, you do not have access to the Admin tab, 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.

15.2.3 Step 1: Code the Asset Descriptor File

As described in Section 15.1.2, "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, read the "AssetMaker Tags" section of the Oracle Fusion Middleware WebCenter Sites Tag Reference and use the tags described in that chapter to code the file. You can use the native XML editor in Oracle WebCenter Sites Explorer to code the file or you can use any other XML editor.

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, if the field is a system field, its storage type must not be changed. For the list of standard fields, their storage types, and allowed changes to storage type, see Section 15.1.3.4, "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 contains the following topics:

15.2.3.1 Sample Asset Descriptor File: ImageFile.xml

If the Burlington Financial sample site is installed on your system, you will find the ImageFile.xml asset descriptor file in the AssetType table. You can either start Oracle WebCenter Sites Explorer and open the file or you can examine it here:

<!-- 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="36" 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>

Examine this asset descriptor file and then, if Burlington Financial is installed on your system, start WebCenter Sites, select the Burlington Financial site, examine the WebCenter Sites forms for the imagefile asset type, and compare the forms to the asset descriptor file.

Note the following about the ImageFile asset descriptor file:

  • The ASSET tag provides a value for the DEFDIR parameter. All asset tables have at least two URL columns (upload fields) by default, which means you must set a value for the default storage directory (defdir) of any new asset type. (the imagefile asset type has two additional URL columns: urlpicture and urlthumbnail.)

    You can set the defdir value either with the ASSET tag's DEFDIR parameter, or with the defdir field in the AssetMaker Create Asset Table form.

    Note:

    A defdir set using the Create Asset Table form overrides a defdir set in the asset descriptor file

    For more information about URL columns, see Section 12.2.3, "Indirect Data Storage with the WebCenter Sites URL Field."

  • There are no PROPERTY statements for any of the default columns that AssetMaker creates in an asset type's database table. Those columns are listed in Section 11.2.4.2, "Default Columns in the Basic Asset Type Database Table."

  • Not every property that has a SEARCHFORM statement has a matching SEARCHRESULTS statement. In other words, if you decide to put a field on the Advanced Search form, it does not mean that you have to display the data from that field on the Search Results form.

15.2.3.2 Example: 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 tab. In order 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>

15.2.3.3 Upload Example 1: 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 30 megabytes.

15.2.3.4 Upload Example 2: A Text Box Field

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" COLS="48" ROWS="25" REQUIRED="YES"/>
</PROPERTY>

15.2.3.5 Upload Example 2: A Text Box Field

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" COLS="48" ROWS="25" REQUIRED="YES"/>
</PROPERTY>

15.2.3.6 Upload Example 3: A CKEditor Field

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

  1. The PROPERTY NAME must begin with the letters url. In other words, you should use a URL column for the field. If you do not, you run the risk of making your field 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. If an excessively large length is used (for example, "5000") this will cause issues with data storage as the database will store the data as a CLOB and the URL field will be corrupted as the data would be stored in the database rather than the file.

15.2.3.7 Upload Example 4: A Field That Uploads a Binary File

The following code creates a field where you can upload a blob. Note that if you do not specify the MIMETYPE, you may not be able to view the blob from the Edit and Inspect forms.

<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>

15.2.3.8 Example: 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:

  • For path, STORAGE TYPE must be set to VARCHAR and LENGTH must be set to 255.

  • For filename, STORAGE TYPE must be set to VARCHAR and LENGTH must be set to 128.

  • For startdate, STORAGE TYPE must be set to TIMESTAMP.

  • For enddate, 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>

15.2.3.9 Example: 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.

15.2.3.10 Example: Using a Query to Obtain Labels for Radio Buttons

If the INPUTFORM TYPE of your property is RADIO, you can 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>

15.2.3.11 Example: Creating a Field with the ELEMENT Input Type

You can modify the fields on your asset forms by using the ELEMENT input type to call custom code to display the fields as you want them. You can use this method to create new 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 exerpt 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 that you must write a separate element for each field that you want to modify.

15.2.4 Step 2: Upload 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. Log in to WebCenter Sites as an administrator.

  2. Select the site in which you want to work.

  3. Select the Admin interface.

  4. Select the Admin tab.

  5. Expand AssetMaker and click Add New.

    The Add New AssetMaker Asset Type form appears:

    Description of l_assetmaker_small.png follows
    Description of the illustration l_assetmaker_small.png

  6. Click in the Name field and 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.

  7. Click the Browse button next to the Descriptor File field and select the asset descriptor file.

  8. 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 displays the Asset Type form:

    Description of n_basic_small.png follows
    Description of the illustration n_basic_small.png

15.2.5 Step 3: Create the Asset Table

This step continues from step 8 of the previous section (Section 15.2.4, "Step 2: Upload the Asset Descriptor File to WebCenter Sites").

  1. Select Create Asset Table.

  2. Examine the value in the Defdir field 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.

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

    If you check 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.

    When it is finished, it displays a confirmation like this one:

    Description of l_basic_confirm_small.png follows
    Description of the illustration l_basic_confirm_small.png

  4. Select Register Asset Elements and then click the Register Asset Elements button.

    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 like this one:

    Description of n_reg_confim_small.png follows
    Description of the illustration n_reg_confim_small.png

15.2.6 Step 4: Configure the Asset Type

When AssetMaker created the new asset type (in Section 15.2.4, "Step 2: Upload the Asset Descriptor File to WebCenter Sites"), it also created an icon and administrative forms for configuring the new asset type, located on the Admin tab.

Complete the following configuration steps:

  1. On the Admin tab, expand the Asset Types icon.

  2. Under Asset Types, select your new asset type. (If you do not see it in the list, click the right mouse button, select Refresh from the context menu, and then select your new asset type.)

  3. Click Edit.

    The following form appears:

    Description of l_assettype_small.png follows
    Description of the illustration l_assettype_small.png

  4. (Optional) Click in the Description field and change it, 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) Click in the Plural Form field and change it, if necessary. The text in this field is the text that WebCenter Sites uses in the WebCenter Sites 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) Click in the Can Be Child Asset field and 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 appears in the list of asset types in the Child Asset Field on the Add New Association forms.

  7. Click Save.

15.2.7 Step 5: Enable 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 the Oracle Fusion Middleware WebCenter Sites Administrator's Guide.

15.2.8 Step 6: Fine-Tune 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 need 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

If you want to make any of the changes in the preceding list, complete the following steps:

  1. Use Oracle WebCenter Sites Explorer to open and modify the asset descriptor file that you uploaded in Section 15.2.4, "Step 2: Upload 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 changes are 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, if you want 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 if you have customized the elements that AssetMaker copied from the AssetStubElementCatalog table to the asset type's directory in the ElementCatalog table, your changes are overwritten when you re-register the elements.

15.2.9 Step 7: (Optional) Customize the Asset Type Elements

There are two ways to customize asset type elements on your content management system:

  • If you require changes that are specific to a certain asset type, you can modify the elements for that asset type in the ElementCatalog table, using Oracle WebCenter Sites Explorer. For information about modifying the elements, see Section 15.2.9.1, "About PreUpdate and PostUpdate Elements."

  • If you require the same modifications for assets of all types, modify the source elements in the AssetStubElementCatalog table, using Oracle WebCenter Sites 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. If you customized elements in the AssetType directory, they 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.

15.2.9.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 Contributor interfaces in order 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. The variable is named updatetype if the element must be called from the Admin interface or from Form Mode of the Contributor interface or the XMLPost utility. The variable is named servicesUpdateType if the element must be called from Web Mode of the Contributor interface.

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, when assets are saved in Sites Desktop, or when assets are imported through XMLPost. Whether operations are performed via 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 Oracle WebCenter Sites Explorer, in the following path:

ElementCatalog\OpenMarket\Xcelerate\AssetType

Table 15-6 defines the values of the updatetype variable.

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 calls 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 via 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.

Table 15-6 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 pdatetype 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.

MSWord

When a Sites Desktop user saves an asset created or edited in Microsoft Word:

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

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

InSite

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

Table 15-7 defines the values of the servicesUpdateType variable.


Table 15-7 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.


15.2.10 Step 8: (Optional) Configure Subtypes

For the basic asset types that you design with AssetMaker, subtype means a subclass of the asset type based on how that asset is rendered. You can use subtypes to define a separate default approval template for an asset of that type and subtype on each publishing target.

This section contains the following topics:

15.2.10.1 Adding Subtypes

To create a subtype

  1. On the Admin tab, 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 appears:

    Description of e_add_subtypes_small.png follows
    Description of the illustration e_add_subtypes_small.png

  4. Click Add New Subtype.

  5. In the next form, click in the first field in the Name column and enter the name of the subtype.

  6. In the corresponding field in 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.

15.2.10.2 Deleting Subtypes

To delete a subtype

  1. On the Admin tab, 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.

  4. In the Subtypes form, click the Delete (trash can) icon.

  5. Click Delete Subtype.

15.2.11 Step 9: (Optional) Configure Association Fields

Associations are described in Section 11.2, "The Basic Asset Model." Briefly, associations are defined, asset-type-specific relationships that describe parent-child relationships or links between individual assets or asset sub-types. 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, the Burlington Financial sample site associates imagefile assets with article assets. The template elements are coded to extract an associated imagefile asset by the name of the association rather than the name of the asset. That way, if you choose a different imagefile for an article, the template displays the new imagefile without your 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 on the Admin tab.

Examples of association fields from the Burlington Financial sample site include the Main Image and Teaser Image associations between article assets and imagefile assets. When you create a Burlington Financial article asset, you can select an image asset from the Main Image and Teaser Image fields.

This section contains the following topics:

15.2.11.1 Adding Association Fields

To add an association field

  1. On the Admin tab, select 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 appears:

    Description of l_association_small.png follows
    Description of the illustration l_association_small.png

  4. Click in the Name field and enter the name of the association field, without using spaces, decimal points, or punctuation marks.

  5. Click in the Description field and enter a short description of the field. Keep the description short because 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. Click in the Child Asset field and 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. Select the subtype or subtypes for this association by highlighting them in the Subtypes field. To select multiple subtypes, press the Control key while you click your selection with the mouse.

  8. Select the appropriate Dependency Type 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. For information about dependency types, see Section 28.2, "About Coding to Log Dependencies."

  9. Click Add.

    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.

15.2.11.2 Deleting Association Fields

Before you delete an association field, be sure to search for any assets that use it and clear the value in the field. Otherwise, those assets will still have the association when you delete the association field, but, because the field is no longer displayed in the WebCenter Sites interface, you will be unable to change it.

To delete an association field

  1. On the Admin tab, select Asset Types.

  2. Under the Asset Types option, select the asset type whose association field you want to delete.

  3. Under the asset type you selected, select the association that you want to delete.

  4. In the form on the right, click Delete.

The association field is now no longer displayed on forms for this asset type.

15.2.12 Step 10: (Optional) Configure Categories

You can use categories to organize your asset types according to some convention that works for your site design. For example, the Burlington Financial sample site uses queries based on category to determine which articles should be selected for various sections of the online site.

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.

This section contains the following topics:

15.2.12.1 Adding Categories

To add a category

  1. On the Admin tab, select Asset Types.

  2. Under the Asset Types option, select the asset type that you want to create categories for. (For example, select Article.)

  3. Under that asset type, select Categories and then Add New.

    The following form appears:

    Description of e_add_category_small.png follows
    Description of the illustration e_add_category_small.png

  4. Click in the Description field and enter a short description of the category. Keep the description short because 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 the Add button.

  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 on the New and Edit asset forms.

15.2.12.2 Deleting Categories

To delete a category

  1. On the Admin tab, select Asset Types.

  2. Under the Asset Types option, select the asset type that you want to delete a category for.

  3. Under that asset type, select the category that you want to delete.

  4. Click Delete.

15.2.13 Step 11: (Optional) Configure Sources

Sources apply to all the asset types in all the sites on your system. Therefore, if you are using Source, you need to add your sources only once (not for each asset type).

This section contains the following topics:

15.2.13.1 Adding Sources

To create a source

  1. On the Admin tab, select Sources, and then Add New.

    The Add Source form appears:

    Description of e_add_source_small.png follows
    Description of the illustration e_add_source_small.png

  2. Click in the Source field and enter the name of a source.

  3. Click in the Description field and enter a short description of the source. Keep this description short because WebCenter Sites uses the text from this field in the drop-down list for the Source field on the forms for assets.

  4. Click Add.

    The source is written to the Source table.

  5. Repeat steps 1 through 4 for each source that you need for your asset types.

15.2.13.2 Deleting Sources

To delete a source

  1. On the Admin form, select Sources.

  2. Under the Sources option, select the name of the source that you want to delete.

  3. In the form for this source, click Delete.

15.2.14 Step 12: (Conditional) Add Mimetypes

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 field.

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 Oracle WebCenter Sites Explorer.

  2. Expand the MimeType table.

  3. Do one of the following:

    • If you are adding a mimetype for the imagefile asset type, select the image folder in the MimeType table.

    • If you are adding a mimetype for the stylesheet asset type, select the text folder in the MimeType table

    • If you are adding 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 select New from the drop-down list.

    Oracle WebCenter Sites 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:

    • If you want to specify more than one extension 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. Click in the keyword field and do one of the following:

    • If you are adding a mimetype for the imagefile asset type, enter image.

    • If you are adding a mimetype for the stylesheet asset type, enter stylesheet.

    • If you are adding 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.

    Oracle WebCenter Sites Explorer saves the row.

    If you added a mimetype code with the keyword of image, that mimetype is now displayed in the Mimetype field of the ImageFile form. If you added a mimetype code with the keyword of stylesheet, that mimetype is now displayed in the Mimetype field of the Stylesheet form.

15.2.15 Step 13: (Optional) Edit Search Elements to Enable Indexed Search

WebCenter Sites and 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 the Oracle Fusion Middleware WebCenter Sites Administrator's Guide.

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 Section 11.2.4.2, "Default Columns in the Basic Asset Type Database Table"). If you want the fields that you created with PROPERTY statements in your asset descriptor file to be indexed, you must 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.

15.2.16 Step 14: Create and Assign 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, we create an image file of type PNG.

  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's Site Tree, Content Tree, and My Work tree.

15.2.17 Step 15: Code Templates for the Asset Type

Creating your asset types and coding the templates for assets of that types is an iterative process. Although you need 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.

For information about coding templates, see Chapter 28, "Coding Elements for Templates and CSElements."

15.2.18 Step 16: Move the Asset Types to Other Systems

When you have finished creating all of your new asset types (including creating templates for them), migrate them 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.

For information about this step, see the Oracle Fusion Middleware WebCenter Sites Administrator's Guide.

15.3 Deleting Basic Asset Types

When you delete an asset type that you created with AssetMaker, WebCenter Sites can either delete components of the asset type that you select, or delete all traces of the asset type from the database. A list of asset type components follows:

  • 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. Log in to WebCenter Sites as an administrator.

  2. Select the site in which you want to work.

  3. Select the Admin interface.

  4. Select the Admin tab.

  5. Expand AssetMaker and then select the asset type that you want to delete.

    The Asset Type form appears:

  6. Select the Delete Asset option and click Submit.

    WebCenter Sites displays a confirmation message.

  7. Click OK.