The Guestbook application accepts submissions from any logged in user, so there’s no telling what people could post. Illegal data, objectionable content, the entire contents of Don Quixote: all of these and more are possibilities. You can make sure user posts don’t run afoul of the law or policy by enabling workflow in your application.

Workflow is a review process that ensures a submitted entity isn’t published before it’s reviewed. To prevent posting objectionable content, an initially submitted Guestbook entry should be marked as a draft and sent through the workflow framework. It comes back to the application code ready to have any relevant fields updated in the database based on its status. The view layer must filter entities by status to display only reviewed entities.

This section instructs the reader in workflow-enabling the Guestbook App’s Guestbook and Entry entities to ensure that only approved content is published after review.


Figure 1: Enable workflow in your assets, just like Liferay Portal’s own assets.

There are five steps to enabling workflow:

  1. Update the service layer to set each entity’s status fields.

  2. Send the entity to Liferay Portal’s workflow framework.

  3. Add getter methods that account for an entity’s workflow status.

  4. Handle the entity as it returns from the workflow framework.

  5. Update the user interface to account for workflow status.

The first three steps happen in the service layer, so that’s a good place to start.

Let’s Go!

Supporting Workflow at the Service Layer

When you asset enabled the Guestbook Application, you added four database columns in the Guestbook entities (e.g., GB_Entry) that keep track of workflow status (they’re already added; celebrate!)....

Read More

Handling Workflow

The guestbook project’s service layer is now updated to handle workflow. It now properly sets the status fields for guestbooks and guestbook entries, gets entities by their statuses, and sends...

Read More

Displaying Approved Workflow Items

There’s not much left to do. Both entities in the guestbook project’s back-end are workflow enabled, so it’s time to update the UI. The Guestbook Admin portlet and the Guestbook portlet each...

Read More
0 (0 Votes)
Implementing Permission Checks Previous