Show the user data of every response for the current Quick Poll in the campaign in a Flex Client, 1st part
In this first part, we will learn the basic about the SAP portal KM library km.appl.ui.quickpoll_api.jar and its configuration for our development environment.
The application that we are going to create will have:
- input: the name of campaign to review.
- output: every user vote of the current quick poll with detail information of the user. As the figure 2.
Before to begin we must take in account that the following things:
- The repository path for the quick poll is "/document/QuickPoll".
- The name of the Quick Poll resource is qp.xml. It is for the current quick poll of the campaign. For the previous and closed quick poll they are located in the history directory of the campaign.
- The namespace of the quick poll service is "http://sapportals.com/xmlns/cm:service.quickpoll.QPService".
- The name of the portal service for quick poll is "AppPropertiesRepositoryService".
- The name of the property is "quickpollvote" (link). This is the most important item because it contains all the info that we will need.
Our final RIA web report will contain information about the every response of current quick poll for the requested campaign, data as full name of the user, email, organization, and finally the vote.
We will create an xml document with the structure as the figure 1.
Figure 1.
The design of the RIA client is shown in the figure 2.
Figure 2
We will create a simple Java project, after we are going to create our pojos entities with the similar structure to the xml structure.
LineQuickPoll.java
LineResponse.java
ReportQuickPoll.java
These classes contain the following attributes with its setter and getter methods. Also they are Serializable, but it is not necessary.
-- LineQuickPoll.java --
private String namePoll;
private String question;
private String statePoll;
private String nameResourceKM;
private Integer totalVotes;
private List listUserResponses;
-- LineResponse.java --
private String userId;
private String userName;
private String email;
private String area;
private String response;
-- ReportQuickPoll.java --
private String nameCampaing;
private List listPolls;
Now, we are going to create our aplication service class, I will name it "SearchService" and it implements the ISearchService interface as I show in the following code.
public interface ISearchService {
/**
* Get the votes per user for the campaign in the current quick poll, the returned text is in an XML Format
* @param map
* @return Return an XML text
* @throws ApplicationException
*/
String getVotesPerCampaingXmlResponse(Map map) throws ApplicationException;
/**
* Get the votes per user for the campaign in the current quick poll
* @param map
* @return Return a ReportQuickPoll object
* @throws ApplicationException
*/
ReportQuickPoll getVotesPerCampaingResponse(Map map) throws ApplicationException;
}
Also I have created a J2EE Server Component Library Project with the purpose to contain all SAP KMC libraries need by the java project, it is only to compilation time, because this libraries are part of the SAP Portal in runtime.
In the next part we are going to review this service class in detail.
Comments