26 Creating Collection Assets, Query Assets, and Page Assets

The core asset types delivered with WebCenter Sites provide basic site design logic. This chapter describes how to create the page, query, and collection assets that implement the functionality of your online site. It also includes a section for the stylesheet asset type, a sample asset type delivered with the Burlington Financial sample site.

The preceding chapter describes how to create Template assets. Because you assign Template assets to your other assets, it is typical to create your templates before you create your site design asset types.

The procedures for working with assets of any type are very similar and are described thoroughly in the Oracle Fusion Middleware WebCenter Sites User's Guide. This chapter presents procedures that are unique for the collection, query, stylesheet, and page asset types.

This chapter contains the following sections:

26.1 Collection Assets

A collection asset stores an ordered list of assets of one type. You create (or design) a collection asset by naming it and selecting query assets for it. By default, you can select up to three query assets. If your site design requires more queries for collection assets, you can create additional associations for the additional queries. For information about creating associations, see Section 15.2.11, "Step 9: (Optional) Configure Association Fields."

A collection uses a query asset to obtain a list of possible assets for the collection. You build (or populate) a collection by running its queries, selecting assets from the results of the queries, and then ranking and ordering the assets that you selected. This ranked, ordered list is the collection.

Using collections is one way to keep the content displayed on rendered pages current and up-to-date. The Burlington Financial sample site uses several collections. For example, you can select a collection in the Top Stories field for a Burlington Financial page asset. A publisher or content provider can then change the content identified by that association by doing one of the following:

  • Selecting a different collection from the tree

  • Building the assigned collection and selecting different assets in it

This section contains the following topics:

26.1.1 Before You Begin

Before you create collection assets, note the following:

  • A collection must have at least one query, so be sure that you create the queries before you try to create your collections.

  • Because you assign templates to collections, you should also create the Template assets before you create your collection assets.

Before you build the collection, you should determine how the Template asset assigned to it is coded. For example, if you select 100 assets for a collection but the template is coded to display only five of them, the following occurs:

  • The rendered page that displays those assets displays only the first five.

  • The page takes longer to render than necessary because WebCenter Sites has to sort through all 100 assets even though it displays only the first five.

For more information about building a collection, see the Oracle Fusion Middleware WebCenter Sites Administrator's Guide.

26.1.2 Creating Collection Assets

To create a collection asset

Note:

To use this procedure, you must have Collection asset types enabled for the site you are working in. Step 6 indicates whether they are enabled.

  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. Make sure that you have completed the steps Section 26.1.1, "Before You Begin."

  5. Click New on the button bar.

  6. Select New Collection from the list of asset types. (If Collection asset types are not enabled, the option is not displayed.)

    The Collection form appears:

    Description of e_new-collection_small.png follows
    Description of the illustration e_new-collection_small.png

  7. (Required) In the Name field, type a descriptive name for the page. You can enter up to 64 alphanumeric characters, but the first character must be a letter. Underscores (_) and hyphens (-) are acceptable, but tab and space characters are not.

  8. In the Description field, type a brief description of the collection. You can enter up to 128 characters.

  9. (Required) In the Subtype field, select the type of asset this collection will hold.

    Note:

    Collection subtypes are controlled by Query. When a query is set up for a certain asset type, that asset type becomes a value of the Subtype field. The SubType field thus lists every asset type for which a query was created. For information about creating Query assets, see Section 26.2.5, "Creating Query Assets."

  10. In the Select a Template field, select a Template asset from the drop-down list.

  11. In the Category field, select a category from the drop-down list. (If you do not select a category, the first item on the list is selected by default.)

  12. In the Keywords field, enter keywords that you and others can use as search criteria in the Advanced Search form when you search for this collection in the future.

  13. In the Associated queries section, select up to three queries. All of the queries that you select for this collection must return assets of the same type.

  14. Click Save.

26.1.3 Sharing Collection Assets

Before you share a collection asset, consider the following:

  • Building a collection in one site builds it in all of the sites that it is shared with. You cannot build a collection to include different assets for different sites.

  • The query assets used in the shared collection must be coded to return only assets that are shared to all the sites that the collection is shared with.

  • As with any shared asset, be sure that the template assigned to the collection is also shared to the other site.

26.2 Query Assets

A query asset stores a database query that retrieves a list of other assets from the database. However, if the query is to be used for a collection, it can return assets of one type only.

This section contains the following topics:

26.2.1 Query Assets and Other Assets

WebCenter Sites uses queries differently in collection assets than it does for other assets:

  • When you build (or populate) a collection, you run one or more query assets and then select and order the assets that you want from the resulting list. The collection is a static list of assets selected from the query resultsets.

  • You can select queries for a page asset either through informal relationships or through named associations. You can select queries for other asset types (article, for example) through named associations.

    When the asset is rendered, it does not invoke the query directly. Either the template element that formats the asset or a template element that formats the query is coded to invoke a standard WebCenter Sites element called:

OpenMarket/Xcelerate/AssetType/Query/ExecuteQuery

This element runs the query asset when the asset it is associated with is rendered, which means the resultset is dynamic.

26.2.2 How the Query Is Stored

A query asset can store its database query in one of two ways:

  • Directly. You can write the query directly into the SQL query field of the Query form. You can either use standard SQL for the query, or, if your WebCenter Sites systems use an external search engine, you can use an appropriate search engine query.

  • Indirectly. You can write the query in an element and then store the location of that element in the query asset by identifying it in the Element name field in the Query form. An element for a query is like any other element: you can use XML, JSP, JavaScript, HTML, and so on.

Most of the Burlington Financial queries store the query directly; that is, the SQL query is written directly into the SQL query field in the Query form. For example, the following code is from the News Wire Feed Query:

SELECT DISTINCT Article.id, Article.name, Article.updateddate, 
Article.subheadline, Article.abstract, Article.description, 
Category.description AS category, StatusCode.description AS 
statusdesc FROM Article, Category, AssetPublication, StatusCode 
WHERE Article.status!='VO' AND Article.category=Category.category 
AND Article.status=StatusCode.statuscode AND Category.assettype='Article' 
AND Article.source='WireFeed' AND Article.category='n' AND Article.id = 
AssetPublication.assetid AND AssetPublication.pubid = 968251170475 
ORDER BY Article.updateddate DESC

26.2.3 Commonly Used Fields for Queries

There are several WebCenter Sites fields, four of which are used in the preceding News Wire Feed query example, that you are likely to use in your queries:

The rest of this section defines the fields in this list.

status

All assets have a status. When an asset is created, WebCenter Sites adds a row to the table that holds assets of that type and sets its status to PL, which means created.

The following table lists and defines the status codes that WebCenter Sites uses:

Status Code Definition

PL

created

ED

edited

RF

received (from XMLPost, for example)

UP

upgraded from Xcelerate 2.2

VO

deleted (void)


These codes are listed in the StatusCode table in the database.

When an asset is deleted, WebCenter Sites changes its status to VO and renames the string in its Name field to its object ID.

Write your queries to exclude assets whose status is VO. For example: WHERE Article.status!='VO'

updateddate

The information in the updateddate field represents the date on which the information in the status field was changed to its current state. Depending on the design of your site, you might want a query to return assets based on this date.

source

The source field is a default WebCenter Sites field that can identify where an asset originated. It is not required.

For example, the Burlington Financial sample site has sources named WireFeed, Asia Pulse, UPI, and so on. You add sources for your sites on the Admin tab in the tree. See Section 15.2.13, "Step 11: (Optional) Configure Sources."

If you use source with your assets, you can write your queries to use source as a parameter. In the previously mentioned News Wire Feed query example, the AND Article.source='WireFeed' statement ensures that only articles with WireFeed in their Source fields are selected by this query.

category

The category is a default WebCenter Sites field that can categorize assets according to a convention that works for your sites. It is not required.

For example, the Burlington Financial sample site has categories named Personal Finance, Banking and Loans, Rates and Bonds, News, and so on. You add categories for your sites on the Admin tab in the tree. See Section 15.2.12, "Step 10: (Optional) Configure Categories."

If you use category with your assets, you can write your queries to use category as a parameter. In the previously mentioned News Wire Feed query example, the Article.category='n' statement includes article assets from the News category.

pubid

A pubid is a unique value that identifies a site (or, in old terminology, a publication). When an asset is created, WebCenter Sites writes information about that asset to several database tables, one of which is the AssetPublication table.

An asset's row in the AssetPublication table includes the pubid of the site the asset was created for. If the asset is shared, the AssetPublication table has a row for each site that the asset is shared with. For example, if an article asset is available in two sites, there are two rows for that article in the AssetPublication table.

If you have only one WebCenter Sites site on your system or if your query results do not need to be site-specific, you do not need to code your queries to consider pubid. The Burlington Financial queries, however, are coded to restrict assets based on the pubid of Burlington Financial (AssetPublication.pubid = 968251170475) so that they do not return assets from another site.

startdate and enddate

Neither of the sample sites use the startdate and enddate fields but the WebCenter Sites database has columns to store this information. These fields exist so that you can assign time limits to assets. If your asset types use the startdate and enddate fields, you can create queries that select assets based on the dates stored in those fields.

26.2.4 Before You Begin

Before you begin creating query assets, consider the following:

  • Query assets that are used on assets other than collections are not required to have templates. You can either create template elements specifically for your query assets that identify, run, and display the results, or you can code the template elements for your page assets to do that.

  • When you write a query for a collection, be sure to code it to select the fields that are required for that asset type. WebCenter Sites is programmed to expect information from an asset type's required fields so that it can display that information in the Build Collection form.

    For example, the Name and Description fields are required fields for a Burlington Financial article. (The Description field is renamed and displayed as Headline in the form.) Therefore, the queries for Burlington Financial collections that hold Burlington Financial articles select the Name and Description fields. Those queries also select several other fields, but WebCenter Sites requires at least the Name and Description fields to present the assets returned by the queries in the Build Collection forms correctly.

  • Query assets that are used only for collections have no need for templates. The template element assigned to the collection formats the assets in a collection's list of assets.

  • For performance reasons, be sure to create efficient queries. For example:

    • Include as much logic as possible in the query rather than in the element that runs and displays the results of the query. For example, if you want to filter or constrain a list of articles, be sure the query performs the filtering or constraining step so that the list returned to the element is complete rather than coding the query to return the entire list and using the element code to constrain the list.

    • Be sure your queries return only the information that the element displays.

  • Query assets that are for collections must return assets of one type only.

26.2.5 Creating Query Assets

To create a query asset

  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. Click New on the button bar.

  5. Select New Query from the list of asset types. (Query asset types must be enabled for your site.)

    The Query form appears:

    Description of e_new-query_small.png follows
    Description of the illustration e_new-query_small.png

  6. (Required) In the Name field, type a descriptive name for the query asset. You can enter up to 64 alphanumeric characters, but the first character must be a letter. Underscores (_) and hyphens (-) are acceptable, but tab and space characters are not.

  7. In the Description field, type a brief description of the query. You can enter up to 128 characters.

  8. In the Template field, select a Template asset from the drop-down list.

  9. In the Category field, select a category from the drop-down list. (If you do not select a category, the first item on the list is selected by default.)

  10. In the Result of query field, select the type of asset that this query returns. (The query can return assets of one type only if this asset is to be used by a collection.)

  11. Do one of the following:

    • If you want to store the query directly in this asset, select Database, click in the SQL query field, and then write your query.

    • If you wrote the query in an element, select Element and then enter the entire name of the element in the Element name field.

  12. Click Save.

26.2.6 Sharing Query Assets

If you plan to share a query asset with another site, consider the following tips:

  • If you want your query results to be site-specific, be sure to include a WHERE clause for pubid so that the query does not return assets to a site where those assets have not been shared.

    • For example, in either a query for a collection or a query for a static site, you can use the following statement:

      WHERE AssetPublication.pubid = SessionVariables.pubid

      because SessionVariables.pubid is always set when you are building a collection or using the Export to Disk function.

    • If the query is to be used on a dynamic site, you can use that same statement as long as you code your elements to either pass in the identify of pubid to the ExecuteQuery element or to set the SessionVariables.pubid variable.

  • Because page assets cannot be shared, you should not share query assets if they return page assets.

  • As with any shared asset, if the query has a template, be sure that the template assigned to the query is also shared with the other site.

26.2.7 Previewing and Approving Query Assets

First, remember that not all query assets have their own templates. If a query asset was designed to be used on a page asset and it is the page asset's template that actually formats the query, you must preview the page in order to preview the query.

If your online site is a dynamic site (that is, you use the Mirror to Server publishing method) a query asset might return different assets on the management system than it does on the delivery system, depending on which assets have been published.

Therefore, if you preview your query to determine whether you should approve it or not, remember that the assets that it returns on the management system (where you are previewing it) could be different than the assets that it will return on the delivery system after it is published.

26.3 Page Assets

Page assets are site design assets that store references to other assets, organizing them according to the design that you and the other designers are implementing.

Open WebCenter Sites and examine the page assets listed in the site tree for the Burlington Financial sample site:

Description of l_b_siteplan_small.png follows
Description of the illustration l_b_siteplan_small.png

These page assets represent sections of the site, in essence the structure or organization of the site. They do not represent each and every rendered page that can possibly be served. This structural organization is primarily for the benefit of your WebCenter Sites users. This is not the only way of organizing your site, but it is convenient for your editors to see a structure that resembles your finished website.

Typically, you create page assets once: when you design the site. You associate collections, queries, articles, and so on with page assets and you code template elements that format the types of assets you want to associate with the page asset.

Before you can select the correct content for your page assets, you must be familiar with how your site is structured and what your template elements for page assets are designed to do. That is why you and other site developers (the people who are coding elements and creating Template assets) typically create the page assets for a site.

This section contains the following topics:

26.3.1 Page Asset Model

Page asset model is similar to the flex asset model. This provides option to change the data structure of the Page asset. Page asset model is made of a family of asset types.They are:

  • Page attribute

  • Page definition

  • Page

Following are some general characteristics of the page asset model:

  • Page assets are described by the page attributes that you select for them.

  • The page attributes that characterize page assets are themselves assets. This means that attributes can be passed through workflow, edited, monitored by revision tracking, and subjected to all other content management operations.

  • If you ever need to add attributes to your asset types in the future (a common occurrence with products), you just create the new attribute and assign it to the appropriate definitions.

  • This asset model supports assets that have many, many attributes, which means that you can support large sets of data.

Page asset model does not have parent definition asset type and parents asset type like the typical flex family and it does not support data inheritance.

26.3.2 Designing Page Attributes

See Section 16.1.4, "Designing Flex Attributes."

Note: Inheritance is not applicable for page assets.

Designing Page Definition

See Section 16.1.6, "Designing Parent Definition and Flex Definition Assets."

Note: The Flex Parent Definition is not supported for page assets and inheritance is not applicable.

Creating Page Attributes

See Section 16.3.6, "Step 4: Create Flex Attributes."

(Optional) Create Page Filter Assets

See Section 16.3.7, "Step 5: (Optional) Create Flex Filter Assets."

Create Page Definition Assets

See Section 16.3.9, "Step 7: Create Flex Definition Assets."

(Optional) Create Page Associations

See Section 16.3.14, "Step 12 (Optional): Create Flex Asset Associations."

26.3.3 Creating a Page Asset

Follow these steps to create a page asset:

  1. Log in to WebCenter Sites, select the site you want to work with and the icon for the WebCenter Sites Contributor interface.

  2. Find and bookmark the assets (articles, queries, images, collections, and so on) you wish to include on the page. Do the following:

    1. In the Search field, enter criteria identifying the desired asset(s) and then click the magnifying glass button. A search tab opens displaying the results of your search.

    2. In the search results list, select (Ctrl+click) the assets you want to bookmark.

    3. In the search tab's toolbar, click the Bookmark icon.

    4. Repeat this step until you have bookmarked all of the desired assets and then continue with the next step.

    A tab opens displaying the results of your search:

    Description of c-new_bookmark_small.png follows
    Description of the illustration c-new_bookmark_small.png

    WebCenter Sites displays a confirmation message and also lists the bookmarked assets under the Bookmarks node in the My Work tree.

  3. In the menu bar, select Content, then New , and then Page Asset. In this example, we use the Page (Home) asset type in the avisports sample site.

    Note:

    If you are using the avisports sample site, assets of type Page are configured to open in Web Mode. Therefore, when you select to create a "Page (Home)" asset, the "Create Page (Home)" dialog box is displayed. To follow this procedure (and create a Page (Home) asset in Form Mode):

    In the "Create Page (Home)" dialog box, do the following:

    1. In the Select Layout field, select the layout you wish to assign to the page.

    2. In the Name field, enter a name for the page. For information about naming the page, see step 5 substep a. Then click Continue.

    3. In the avisports sample site the page definition is chosen when you select the type of page asset you will be creating. However, if this is not the case in the site you are working with (for example, FirstSiteII), you will see a Page Definition field. Use this field to specify the page definition for the page you are creating and then click Continue.Switch to Form Mode. In the asset's toolbar, click the Mode switch. Continue to step 5 substep b.

    4. The asset's Create view is displayed in Form Mode.

    Description of b-new_pagenew_small.png follows
    Description of the illustration b-new_pagenew_small.png

  4. Create the Page asset.

    1. In the Name field, enter a name for the page. type a descriptive name for the page. You can enter up to 64 alphanumeric characters, but the first character must be a letter. Underscores (_) and hyphens (-) are acceptable, but tab and space characters are not.

    2. Page Definition (if applicable): In the avisports sample site the page definition is chosen when you select the type of page asset you will be creating. However, if this is not the case in the site you are working with (for example, FirstSiteII), you will see a Page Definition field. Use this field to specify the page definition for the page you are creating and then click Continue.

    3. In the Template field, select a template from the drop-down list.

    4. To add items, select the desired assets from the Bookmarks node in the My Work tree and then drag and drop the selected items into the desired field.

  5. In the asset's toolbar, click the Save icon.

    The page is saved. It now appears in the Site Tree under the Unplaced Pages pages node. To place the page, see Section 26.3.4, "Placing Page Assets."

26.3.4 Placing Page Assets

After you create a page asset, you position it in the appropriate location in the site tree by using the Place function.

To place a page asset

  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. Click the Site Plan tab, where you should see the site tree with the new page asset in the Unplaced Pages list, as shown here:

  5. Expand the list of Placed Pages in the site tree.

  6. Select a parent for the page you are placing by doing one of the following:

    • If you want to place a page at the top-most level in the tree, right-click on the Placed Pages icon.

    • Otherwise, right-click on the placed page under which you want to insert the new unplaced page, and choose Place Page from the context menu.

    The place page form appears in the work area on the right. It lists all child pages that are placed under the parent page. It also lists all pages that have not yet been placed in the site tree:

  7. Place the page:

    In the list of unplaced pages, type a number in the Rank field to designate the new page's position in the list of child page assets. Position numbering starts at 1, the top of the list. (In this example, it makes sense to type 1.)

  8. Click Save.

    The unplaced page asset moves to the site tree, to its assigned rank. (To view the page asset in its new location, you may need to right-click in the site tree and choose Refresh All from the context menu.)

  9. Preview both the parent page and the placed child page. See Section 26.1, "Collection Assets" for instructions.

26.3.5 Moving Page Assets in the Site Tree

In addition to placing unplaced pages, you can also use the place page form to:

  • Change the order of child pages within the same parent page.

  • Move a child page from one parent page to another.

Re-ordering Child Pages

To re-order children of the same parent page:

  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. Click the Site Plan tab and expand the list of Placed Pages in the site tree.

  5. Right-click on a placed page that has more than one child page, and choose Place Page from the context menu.

    The place page form appears in the work area on the right.

  6. In the list of placed child pages, type new values in the Rank column to re-order the child pages.

  7. Click Save.

    The child pages move to their new positions in the site tree.

Changing Parent Pages

To move a child page from one parent page to another:

  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. Click the Site Plan tab and expand the list of Placed Pages in the site tree.

  5. Remove the page asset from its parent page:

    1. Right-click on the placed page whose child page you want to move, and choose Place Page from the context menu.

      The place page form appears in the work area on the right.

    2. In the list of placed child pages, select the Remove check box next to the child page that you want to move.

      Description of n_placed-avi_small.png follows
      Description of the illustration n_placed-avi_small.png

    3. Click Save.

      The child page moves to the list of Unplaced Pages in the site tree.

  6. Place the page asset under its new parent page:

    1. In the site tree, right-click on the placed page where you want to insert the unplaced child page, and choose Place Page from the context menu.

      The place page form appears in the work area on the right.

    2. In the list of unplaced pages, type a number in the Rank field to designate the new page's position in the list of child page assets. Position numbering starts at 1, the top of the list. (In this example, it makes sense to type 1.)

    3. Click Save.

      The previously unplaced page asset moves to the site tree, to its assigned rank.

26.3.6 Placing Page Assets and Workflow

WebCenter Sites has a workflow feature that controls the flow of assets as they pass from one team member to another; for example, from author to editor to approver to publisher. The workflow administrator can create processes that control who can place page assets in the site tree and during which workflow step they can do so. Note the following:

  • The Place Page workflow privilege controls all place page functions: Place Pages, Remove, and Rank.

  • You must have the proper privileges for both the parent page on which you invoke Place Pages, and for any child page that you want to Rank or Remove.

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

26.3.7 Editing Page Assets

In general, there are two ways to edit an existing page asset:

  • Change the assets, but not the asset types, that are included on the page. For example, move new assets to the Contains list from your Bookmarks; select a different collection, query, or article from a named association field; or rebuild a collection already associated with the page asset to include different assets.

  • Create a new association or change the actual structure of the page asset in some way.

Although you may frequently change the content in the collections or queries on a page at regular intervals, you are less likely to change the associations, asset types, or structure of a page after the site goes live. This may also require you to edit the code in the template element that formats the page.

26.3.8 Deleting Page Assets

During your site design phase, it is likely that you will create and delete many page assets. However, before deleting a page asset from a site that you have published, be sure that you understand the consequences. For example:

  • Have you removed references to the page from other page assets?

  • Are any of your other page templates coded to extract and use information about this page asset in any way?

Before you delete a page asset, be sure to remove any references to it from any other elements or pages. It is a good idea to unplace a page asset before you delete it.