47 Working with the Articles Sample Application
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:
About the Articles Sample Application
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.
Launching the Articles Sample Application
To be able to launch the Articles sample application, you build and deploy it, and then run the installer.
Topics:
Registering the Articles Sample Application
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.apppage: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
csUserNameandcsPassword, 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.javaregisters the Articles application with the WEM Framework:-
InstallController.javacreates an application asset namedArticles(asset typeFW_Application) in the WebCenter Sites database.The
iconurlattribute points to the URL where the icon representing the application is located.The
layouturlattribute specifies the URL of thelayout.apppage (implemented byLayoutController.java). Thelayout.apppage defines the application layout.The
layouttypeattribute takes the default (and only) value:layoutrenderer. Using thelayoutrenderervalue, the UI container is responsible for rendering the application's associated views by using thelayout.apppage, specified bylayouturl. -
InstallController.javacreates a view asset namedArticlesView(asset typeFW_View) in the WebCenter Sites database. The association between the view asset and the application asset is made through theviewsattribute in theFW_Applicationasset type.
-
-
InstallController.javainstalls the application's asset model and sample assets:-
Creates the application's
FW_Articleasset type in the WebCenter Sites database. (FW_Articleis a basic asset type defined inInstallController.java.) -
Enables the
FW_Articleasset type on the site that was specified in thecsSiteNameparameter inapplicationContext.xml(step 5 of Building and Deploying the Articles Application). -
Writes the two sample article assets to the
FW_Articleasset type tables. (The articles' text and images are stored in:/sample app/articles/src/main/resources/install.)
-
-
InstallController.javacreates an asset type-based index to support searches on assets of typeFW_Article. (The controller specifies index configuration data.)
-
-
When the installation process completes successfully,
InstallController.javadisplays a confirmation (athttp://<server>:<port>/articles/install.app), that the sample data imported successfully and directing you to the Home page (home.app).
