The Articles sample application is a simple content management application for managing article assets. When you work with the application’s richly documented source code and a self-installation process, it will help you gain knowledge that you’ll find useful in developing applications.
Topics:
The Articles home page displays two articles that you can edit directly in WEM from the custom interface. In this application, you can use the WebCenter Sites REST API to perform a search query from Java code and a modification asset query from JavaScript code. You will be able to run the Articles application and REST services on different application servers.
Cross-domain restrictions in JavaScript prevent AJAX calls directly from the Articles application to the REST services. Therefore, a simple ProxyController
is introduced to redirect calls from JavaScript to WEM REST Web Services. Custom implementations may reuse this controller implementation.
The application's home page looks like this figure:
The Articles application is based on the Spring MVC framework. Articles includes a predefined administrative user named fwadmin
with password xceladmin
, who is assigned to the REST group named RestAdmin
. The application's self-installer contains specifications for registering the Articles application and installing its asset model and sample articles. The application does not have internally configured sites or role-protected functions. It has a single, iframe view. Additional specifications are available in Working with the Articles Sample Application.
To be able to launch the Articles sample application, you build and deploy it, and then run the installer.
Topics:
The Articles application has a self-installer, which starts running when you log in to the install.app
page. The installer registers the sample application (including the view) and creates its data model and assets in the WebCenter Sites database.
Note:
Specifications for the registration asset types FW_View
and FW_Application
can be found in the Java API Reference for Oracle WebCenter Sites and in Registering Applications Manually in WEM Framework.
To run the Articles installer:
Navigate to the install.app
page:
http://<hostname>:<portnumber>/<context_path>/install.app
For example:
http://localhost:9080/articles-1.0/install.app
Use any credentials to log in.
The application's predefined user, specified by csUserName
and csPassword
(see Building and Deploying the Articles Application), provides you with permissions to the application. The sample application does not perform authorization checks as it does not use roles.
The self-installation process invokes InstallController.java
, which first registers the application (including the view, in an application Bean), then writes the sample asset type and assets to the database.
InstallController.java
registers the Articles application with the WEM Framework:
InstallController.java
creates an application asset named Articles
(asset type FW_Application
) in the WebCenter Sites database.
The iconurl
attribute points to the URL where the icon representing the application is located.
The layouturl
attribute specifies the URL of the layout.app
page (implemented by LayoutController.java
). The layout.app
page defines the application layout.
The layouttype
attribute takes the default (and only) value: layoutrenderer
. Using the layoutrenderer
value, the UI container is responsible for rendering the application's associated views by using the layout.app
page, specified by layouturl
.
InstallController.java
creates a view asset named ArticlesView
(asset type FW_View
) in the WebCenter Sites database. The association between the view asset and the application asset is made through the views
attribute in the FW_Application
asset type.
InstallController.java
installs the application's asset model and sample assets:
Creates the application's FW_Article
asset type in the WebCenter Sites database. (FW_Article
is a basic asset type defined in InstallController.java
.)
Enables the FW_Article
asset type on the site that was specified in the csSiteName
parameter in applicationContext.xml
(step 5 of Building and Deploying the Articles Application).
Writes the two sample article assets to the FW_Article
asset type tables. (The articles' text and images are stored in: /sample app/articles/src/main/resources/install
.)
InstallController.java
creates an asset type-based index to support searches on assets of type FW_Article
. (The controller specifies index configuration data.)
When the installation process completes successfully, InstallController.java
displays a confirmation (at http://<server>:<port>/articles/install.app
), that the sample data imported successfully and directing you to the Home page (home.app
).