Having users create Polls in your (and their) ADF/WebCenter application – at run time

1

The Patch Set 3 release of Oracle Fusion Middleware hit the streets a few days back. For many of the FMW components, this release is one that fixes bugs, stabilizes, provides better integration and perhaps adds a feature or two. Nothing major really. However, for WebCenter this Patch Set 3 is pretty substantial, in terms of new functionality! Especially when it comes to ‘design time @ run time’ and the availability of services around social networking and collaboration as well as content integration, PS3 is quite impressive. In a recent article I demonstrated one of the PS3 Design Time at Run Time features: ‘create data controls at run time’: http://technology.amis.nl/blog/10555/webcenter-11gr1-ps3-design-time-at-run-time-with-a-vengeance-introducing-run-time-data-controls-and-data-visualizations.

This article discusses another interesting piece of functionality that hands over control to run time administrators, content editors and perhaps even end users: the Polls Service. Through the Polls Service, surveys or polls can be created at run time. Questions can be defined, the results can be analyzed and administration facilities are provided – such as when the poll opens and closes and making sure that a user cannot take the poll multiple times. To use the Polls Service, a Data Source connecting to the WebCenter database schema needs to be set up (same as for many of the WC Services).

An example of a poll, created at run time, is shown below:

poll18

This article demonstrates how a default Portal Framework Application – with absolutely no design time coding applied – is enhanced at run time through the creation of a poll. This poll surveys the interests and opinions of employees of the company about the yearly company outing – always a hotly debated topic.

Assuming that JDeveloper 11gR1 PS3 with the WebCenter extensions is up and running and assuming that a default (WebCenter) Portal Framework application was created and the index.html file in that application is started on the Integrated WLS and finally assuming that a user with administration privileges is logged in (say weblogic/weblogic1) and has entered the administration page, here it goes:

On the Services tab, click the Polls Service. Then click the Create Poll icon.

poll1

The Create Poll popup appears. Provide name and description for the poll.

poll2

Then click Create to create the poll.

poll3

The overview of the poll appears. Open the Add dropdown menu and select the option to add a question. Note that with Add Section we can structure a more extensive poll and with Apply Template we can populate the poll with an existing template (poll).

poll4

Select the type of the new question. Note that only questions with predefined answers are supported: a question type with a free format answer is not available. However, it is possible to include a free format comment field with each question, so with a little trickery it is more or less possible to have free format answer-type questions.

For the question type Multiple Choice (Only One Answer) – a radio button style question – we need to provide the question and all the answer options:

poll5

We can allow poll-takers to type a comment – and specify the label for that comment field – and indicate whether a poll can be completed without an answer to this question (Require Answer to Question). Click OK to create the question.

poll6

We will add a second question, of the Matrix type:

poll7

Press OK to complete the creation of the question.

poll8

Click on the Schedule tab to configure when the poll will be available for completion.

poll9

We can also indicate the introduction message for the poll and the text that is shown to the user when she or he completes the survey.

Click on the Settings tab:

poll10

Rather than showing the exit message, it might be more interesting for users to see the results of the poll so far, including their own responses. The results are shown graphically.

poll11

Click on Save to close the Poll-editor and commit all changes.

poll12

The overview page with all polls appears. Click on the Services tab. We will now add the new Poll to one of the pages in the Portal. Since we have only a single page at this point – Home – we will add the poll to that page.

poll13

Select the Home page and select Edit Page from the Actions menu. Home appears in Edit mode.

poll15

Press the Add Content button. This will bring up the Resource Catalog Browser.

poll16

Open the Polls and Surveys folder. Click on the Add icon for Take Polls. Since there is only one Poll available, we do not need to explicitly select it. This Company Outing poll is automatically added to the Home page.

poll17

Close the page editor. This returns the user to the page in view mode. Now we can actually participate in the survey, as is shown below.

poll18

Click on the Vote button to submit the answers to the poll’s questions.

The results of the poll so far appear. Since our user is the only one to have participated, these results are fairly unsurprising:

poll19

Each question has its own graphical overview:

poll20

When the users leaves the poll results and returns to the Home page, the Take Polls area is empty, as their are no more polls for the user to participate in. Note: when there are multiple open polls in the application that the user has not yet participated in, the most recent is displayed in this area. When the user has participated in the most recent poll, the next in line will be displayed. Alternatively, the administrator can make this area display only one specifically selected poll, instead of the most recent one not yet participated in.

poll21

After multiple users have participated in the poll, the analysis of the results becomes a little more interesting and we can start planning the company event:

poll22

although there seems to be little common ground between all respondents…

poll23

Conclusion

It is extremely simple to have application administrators or content editors or other qualified staff create polls in the portal application (note: any ADF application enriched with WebCenter Services can be called a portal application, there is nothing really special about it). Creating a poll is very simple – no technical skills required. The polls look pretty okay – and will assume the same style used by the application at large. The graphical visualization of the poll results is slick – and I have not even shown the 3D view. Well, here it comes:

poll25

Quickly gathering information to impromptu questions is dead easy.

I feel it is a little unfortunate that only questions with predefined choices are available. I can see how these questions are easier to process and the comment field provides some sort of work around. I guess the Polls Service is not meant to a real “form-editor at run time” (that facility exists through the “data control and data visualization at run time ” feature.

Note that it is not just at run time that we can add Polls Service components to the application, we can do the same at design time. Below is the Resource Palette with the Data Controls and Task Flows available around Polls.

poll24

However, the definition of the Polls is a runtime activity.

Note: at this point I have not yet figured out how to take a look at the values entered in the comments fields that can be defined for each of the poll questions. They do not seem to be included in the standard View Poll Results facilities and may have to be added using the Take Poll Data Control’s getResults operation or perhaps through a customized version of the View Poll Results task flow. More on that in a later article.

Note2: the results from all polls are stored in the WebCenter database schema. The table WC_SURVEY_RESPONSE contains the answers to the polls.

poll26

On closer inspection, it seems like the values from the comment fields are not even stored in the database right now. Could this be a bug?

Resources

WebCenter 11gR1 PS3 Developer Guide on Polls Service: http://download.oracle.com/docs/cd/E17904_01/webcenter.1111/e10148/jpsdg_polls.htm

WebCenter 11g R1 PS 3 User Guide – Working with the Polss Service: http://download.oracle.com/docs/cd/E17904_01/webcenter.1111/e10149/polls.htm#WCSUG6961

Share.

About Author

Lucas Jellema, active in IT (and with Oracle) since 1994. Oracle ACE Director for Fusion Middleware. Consultant, trainer and instructor on diverse areas including Oracle Database (SQL & PLSQL), Service Oriented Architecture, BPM, ADF, Java in various shapes and forms and many other things. Author of the Oracle Press book: Oracle SOA Suite 11g Handbook. Frequent presenter on conferences such as JavaOne, Oracle OpenWorld, ODTUG Kaleidoscope, Devoxx and OBUG. Presenter for Oracle University Celebrity specials.

1 Comment

  1. Hi Lucas,
    Nice post.
    For the Poll comments we are receiving similar feedback that it cannot be viewed by any Poll’s tf:
    There is an Enhancement
    Bug 11819965: POLL OWNER SHOULD BE ABLE TO SEE THE POLL COMMENTS for the same.
    -Pramod

Leave a Reply