By using polls, teamspace members can offer multiple-choice questions to other members. Polling features include the ability to prioritize polls and allow comments from respondents. Closed polls and their data may be stored, retrieved, and searched.
The Collaboration API contains elements that developers can use to create, access, and manage polls from within FileNet P8 applications. Key polling elements are:
A poll comprises the following basic information:
A poll is established when the above information is added to a PollInfo object and passed to a FolderContainer object. Participants may then respond to the poll, with or without comments, through the Poll object's respond method. Polling continues until the closing date/time is met or when the creator-owner of the poll closes the survey through the Poll object's close method.
Polls are created and maintained within a _polls folder, a subfolder of a teamspace's _internal folder. The _polls folder implements the FolderContainer interface (an extension of the Container interface) and is based on the containment capabilities of a Content Engine Folder object.
The polls folder is accessed through any of the following ContainerManager methods:
Collaboration.COLLABORATION_POLL_CONTAINER_DEFID
. Collaboration.TYPE_POLL
; the id must be a GUID of a CollaborationPoll Content Engine object.A new Poll object is created when a PollInfo object is passed to the FolderContainer object's addSubContainer method, as described in the code below.
The following code describes how a Poll object might be created in a known object store and teamspace. For information on teamspace objects, see Teamspaces; for information on creating and managing object stores, see the Content Java API topic, Working With Object Stores.
// pass basic poll construction data to a new PollInfo object
PollInfo pollInfo = new PollInfo();
ArrayList participantIdList = new ArrayList();
SubjectInfo subjectInfo =
CollaborationFactory.findSubjectInfo(objectStore, "bill", BaseObject.TYPE_USER, vwSession);
participantIdList.add(subjectInfo.getID());
subjectInfo =
CollaborationFactory.findSubjectInfo(objectStore, "betty", BaseObject.TYPE_USER, vwSession);
participantIdList.add(subjectInfo.getID());
pollInfo.setParticipants((String[])participantIdList.toArray(new String[0]));
Date closingDateTime = new java.util.Date(currentDateTime.getTime() + 5000000 );
String question = "How many miles do you travel to work?";
String[] possibleResponses = {"Less than 5","5-14","15-39","40 or more"};
int priority = 3; //low level; 2 is normal, 3 high;
boolean responsesHiddenFlag = true; // may be used as a "hint" if the need arises
// to restrict display of results to the poll owner
pollInfo.setClosingDateTime(closingDateTime);
pollInfo.setQuestion(question);
pollInfo.setPossibleResponses(possibleResponses);
pollInfo.setResponsesHiddenFlag(responsesHiddenFlag);
pollInfo.setPriority(priority);
pollInfo.setParticipants(pollParticipantNames);
pollInfo.setOwnerID(ownerID);
// create a container for the poll and pass in the new PollInfo object to create the Poll
ContainerManager containerManager = teamSpace.getContainerManager();
FolderContainer pollContainer = (FolderContainer)
containerManager.getContainerByDefinitionID (Collaboration.COLLABORATION_POLL_CONTAINER_DEFID);
Poll pollObject = pollContainer.addSubContainer(pollInfo);
Responses may be added immediately upon creation of a new poll. Participants respond through the Poll object's respond method:
int responseIndex = 2; // select "15-39" in the zero-based possibleResponses list above
String comment = "Not as far as traffic congestion makes it seem";
pollObject.respond(memberID, responseIndex, comment);
For information on how polls are created and managed within the Team Collaboration Manager application, see Using Polls.