A collection asset stores an ordered list of assets of one type. A query asset stores a database query for retrieving a list of other assets from the database. Page assets are site design assets that store references to other assets in a designed fashion. Easy-to-use forms are available in the Admin interface for you to create collection, query, and page assets.
The core asset types delivered with WebCenter Sites provide the basic site design logic. Because you assign Template assets to your other assets, it is typical to create your templates before you create your site design asset types.
Coding Templates for In-Context and Presentation Editing describes how to create Template assets.
The procedures for working with assets of any type are very similar and are described thoroughly in Working with Assets in Using Oracle WebCenter Sites. This chapter presents procedures that are unique for the collection, query, and page asset types.
Content contributors use collection assets to store ordered lists of assets. Each collection asset can store a list of assets of one type only. 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. You can create additional associations for additional queries if the need arises.
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. For example, you can have a site that uses several collections. If you select a collection to be displayed on an asset, a publisher or content contributor 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 includes the following topics:
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 Determining Function Privileges in Administering Oracle WebCenter Sites.
You can create a collection asset through the Admin interface.
To use this procedure, you must have Collection asset types enabled for the site you are working in. Step 4 indicates whether they are enabled.
The Collection form opens.
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. See Creating a Query Asset.
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.
For the basic procedure on sharing assets, see Sharing Blog Assets Sharing Blog Assets in Administering Oracle WebCenter Sites.
A query asset stores a database query that retrieves a list of other assets from the database. If you plan to use a query for a collection, remember that it returns assets of one type only.
See these topics about query 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:
This element runs the query asset when the asset it is associated with is rendered, which means the resultset is dynamic.
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.
The following code is an example of a query named News Wire Feed which is stored directly; that is, the SQL query is written directly into the SQL query field in the Query form:
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
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.
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.
Table 23-1 lists and defines the status codes that WebCenter Sites uses.
Table 23-1 Status Codes
received (from XMLPost, for example)
upgraded from Xcelerate 2.2
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:
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 can use a query to return assets based on this date.
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, if you had a banking site, you could have 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 Configuring Categories (Optional) in Creating Basic Asset Types.
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 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
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
If you have only one WebCenter Sites site on your system or if your query results do not have to be site-specific, you do not have to code your queries to consider
pubid. However, if you do not want your queries to return assets from another site, you can code your queries to restrict assets based on the
pubid of the 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.
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.
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, 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.
You can create a query asset through the Admin interface.
The Query form opens.
To store the query directly in this asset, select Database, and in the SQL query field 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.
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
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 if you code your elements to either pass in the identify of
pubid to the
ExecuteQuery element or to set the
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.
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 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.
Page assets are site design assets that you use to store references to other assets, organizing them according to the design that you and the other designers are implementing.
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 includes the following topics:
The page asset model is similar to the flex asset model. This provides an option to change the data structure of the Page asset. The page asset model is made up of the following asset types:
The 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 have 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.
The 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.
For designing attributes, see Designing Flex Attributes.
Note: Inheritance is not applicable for page assets.
For designing page definition, see Designing Parent Definition and Flex Definition Assets.
Note: The Flex Parent Definition is not supported for page assets and inheritance is not applicable.
To create a page asset:
Log in to WebCenter Sites, select the site you want to work with and the icon for the Oracle WebCenter Sites: Contributor interface.
Find and bookmark the assets (articles, queries, images, collections, and so on) you want to include on the page. Do the following:
In the Search field, enter criteria identifying the asset(s) and then click the magnifying glass icon. A search tab opens displaying the results of your search.
In the search results list, select (Ctrl+click) the assets you want to bookmark.
In the search tab's toolbar, click the Bookmark icon.
Repeat this step until you have bookmarked all of the assets and then continue with the next step.
A tab opens displaying the results of your search:
WebCenter Sites displays a confirmation message and also lists the bookmarked assets under the Bookmarks node in the My Work tree.
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.
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.
In the Create Page (Home) dialog box, do the following:
In the Select Layout field, select the layout you want to assign to the page.
In the Name field, enter a name for the page, and then click Continue.
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, 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 4b.
The asset's Create view is displayed in Form Mode.
Create the Page asset.
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.
Page Definition field (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, 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.
In the Template field, select a template from the drop-down list.
To add items, select the assets from the Bookmarks node in the My Work tree and then drag and drop the selected items into the field.
In the asset's toolbar, click Save.
The page is saved. It now displays in the Site Tree under the Unplaced Pages pages node.
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 at the top-most level in the tree, right-click the site navigation node and select Place Page from the context menu.
Otherwise, right-click 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 opens 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:
The unplaced page asset moves to the site tree, to its assigned rank. To view the page asset in its new location, you may have to right-click in the site tree and choose Refresh All from the context menu.
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.
To re-order children of the same parent page:
The place page form opens in the work area on the right.
The child pages move to their new positions in the site tree.
To move a child page from one parent page to another:
Open the Admin interface.
In the Site tree, expand the Site Navigation node, and then expand the site navigation node containing the child page you want to move under a different parent page.
Remove the page asset from its parent page:
Right-click the placed page whose child page you want to move, and choose Place Page from the context menu.
The place page form opens in the work area on the right.
In the list of placed child pages, select the Remove check box next to the child page that you want to move.
The child page moves to the list of Unplaced Pages in the site tree.
Place the page asset under its new parent page:
In the site tree, right-click the placed page where you want to insert the unplaced child page, and choose Place Page from the context menu.
The place page form opens in the work area on the right.
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.
The previously unplaced page asset moves under the site navigation node containing the parent asset, in its assigned rank.
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 Creating and Managing Workflow Processes in Administering Oracle WebCenter Sites.
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 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.
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.