WCM customers frequently want to preview draft WCM content in an actual WebSphere Portal context before approving that content.
Out of the box, WCM only supports a “preview” button on the WCM Authoring GUI that will pop-up a window in the browser and display draft content via the presentation template assigned to that content. However. the methods that a user might use to get to this new component cannot be preview. Fro example, the preview button does not allow the viewing of new draft content in an existing WCM Menu component.
This topology and code sample code provides one solution for this problem.
To implement a preview server topology, we need at least 3 servers. The high level picture looks like this:
From the picture, you can see that the WCM Authoring Server is a syndication source. It will syndicate content to two systems. One is the Production Rendering Server. The other system is the WCM Preview Server.
The WCM Preview Server is a subscriber only; it will not syndicate content but only receive it. Further, in Portal 7, all page definitions that are required to render content via WCM rendering portlets must be defined. In Portal 8, Portal pages themselves can be syndicated along with the WCM content.
Once content is syndicated to the preview server, it will automatically be advanced from “draft” status to “publish” status. By doing this, all content will immediately render (on the preview server) via the Portal page's WCM rendering portlets. So, for example, content which is “draft” on the authoring server will appear on the preview server in WCM menus exactly as they would ultimately appear on the production rendering server.
An approver could look at the draft content in a traditional Portal content on the preview server. If the approver wishes to advance the draft content in it's workflow after previewing it, he would go on the authoring server and move the draft item to the next stage of the workflow. Ultimately, the content would move to the publish state on the authoring server and be syndicated to the production rendering server. Note that it would also re-syndicate to the preview server with a new state.
In order for this scheme to work, all content that syndicates to the preview server will need to move from the “draft” state to the WCM “publish” state automatically. By moving to the “publish” state, the draft content will be viewable in the WCM rendering portlets contained on the actual portal pages.
One approach to automatically covert this content to the “publish” state would be to write Java code which listens for the updating of items on the preview server. The mechanics of the process rely on fact that WCM can generate a JMS message anytime an item is created, updated or removed if configured properly. When an “itemUpdated” event occurs on the preview server WCM will fire a JMS message. This JMS message will contain the identification of an item that was updated.
The act of “subscription” causes an item to be updated on the preview server. If the item that is syndicated is in “draft” state, JMS handlers will be deployed on the subscriber which will consume the JMS “itemUpdated” message. The new JMS handler (a Javabean) is notified as each item is processed on the subscriber. This Javabean will iteratively move the syndicated content thru it's workflow stages until it reaches the “publish” state. This conversion to “publish” state will allow the content item to be shown in Portal pages and WCM rendering portlets.
Sample code is included which consumes the JMS itemUpdate message and iteratively moves the item thru the item's workflow stages until it reaches the “publish” state.
Simply install the provided EAR file as a WebSphere Application.
WCM Setup Required
In order to use the code, WCM must be configured to generate JMS events on an item update event. To do this, refer this WCM configuration URL.