Author: jcouteau Date: 2009-12-14 18:20:53 +0100 (Mon, 14 Dec 2009) New Revision: 2821 Modified: trunk/src/site/rst/analyse.rst Log: Fix rst rendering Modified: trunk/src/site/rst/analyse.rst =================================================================== --- trunk/src/site/rst/analyse.rst 2009-12-14 10:05:18 UTC (rev 2820) +++ trunk/src/site/rst/analyse.rst 2009-12-14 17:20:53 UTC (rev 2821) @@ -1,388 +1,366 @@ -Analysis -======== - -:Author: Erwan NEMA <nemawan@hotmail.com> -:Author: Nolwenn Rannou <rannou@codelutin.com> -:Revision: $Revision: 2773 $ -:Date: $Date: 2009-09-09 12:05:20 +0200 (mer., 09 sept. 2009) $ - -The needs -~~~~~~~~~ - -Pollen project is aimed to create a libre poll application with a web interface -and more functionalities regarding the other similar application already existing. -The principle is : a user create a poll and then send the link to the voters. -He can then follow the poll progression online. The voters vote by filling their -name and their vote. - -The poll creation have to be easy but allow the following operations : - -- define voters lists -- chose the vote counting principle (percentage, Condorcet,...) -- allow every voter to add new choices -- vote anonymously if we use a restricted list of voters -- send reminders to people who did not vote (if restricted voters list) -- define begin and end dates for polls. -- define the number of votes possible per person (1 choice or N choices amongst -the propositions) -- be able to add a global comment or to his vote. -- define, before the vote, the weight of each voter (if restricted voters list) -- represent graphically the poll results -- export a poll in a standard format (poll, voters lists, poll results) for -exchanges with other poll tools. - -Global concepts -~~~~~~~~~~~~~~~ - -This paragraph presents the different concepts manipulated by the poll application. -The table represents this application's data table. - -- Poll (Poll) : a poll is a survey with is taken by participants (voters). -The poll/survey can focus on a question with multi-answers, a date choice. -- Prevent rule (PreventRule) : management of poll end rules (voters quota, date before reminder, ...). -- Free poll (FreePoll) : the poll is available for anybody. -- Restricted poll (RestrictedPoll) : the poll is available only for the restricted list members. -- Group poll (GroupPoll) : the poll is available for members of more than one restricted list. -- Vote : answer from a voter to the question, this answer is stored before beeing -processed, the voters identity is then known. -- Anonymous vote (AnonymousVote) : answer from a voter to the question asked without knowing the voter's identity. -- Vote counting type (VoteCounting) : Poll results utilizing, the vote counting can be done -normally(just counting the votes), in the case of multiple choice with Condorcet -method (a preference order is attributed to choice), or by attributing a percentage -to each choice. -- Choice type (ChoiceType) : Define the question and so the answer/choice type (yes/no, hour choice, -date choice, text, picture,...) -- User (User) : People managing the poll, this person can be logged in or not. -- Voter (VotingPerson): People voting in a poll. -- Poll creator (PollAccount): Person already logged in or not, creating a poll. -- Voters predefined list (PersonList) : Voters predefined list created by a user and stored -in the system. This list can be the base for a voters restricted list. -- Voters list (VotingList) : List of voters participating in a poll. -- Voters list type (ListType) : -- Free voters list : Voters list, voters may not need to have an account on pollen. -- Restricted voters list (RestrictedVotingList): Voters restricted list, all the voters are known and -will be identified from this list. -- Voting group (VotingGroup): Restricted list of voters that might be globally balanced when counting votes (ex : developers group) -- Global comment (Comment): Comment on the poll -- Local comment (Vote.comment): Comment on a vote. - -Vote counting types -+++++++++++++++++++ - -For first versions, we implement usual vote counting : - -- Simple or free vote : this is the vote for a single answer, each answer gets votes, the -sum of the votes for each answer represent the poll results. -- Condorcet vote : the voter sort his choices by preference order (ex a>b>c), we -compare each choice to the other votes by counting the won or lost duels, -the results of this comparison represents the poll results. -- Grade balanced vote : each choice is graded (function of a scale), -the sum of the grades per answer represents the poll results. - -Balancing -+++++++++ - -Each voter may not have the same weight in a vote, so this balancing will have -consequences when counting votes. The balancing of each voter is possible in a -restricted list. -It is also possible to balance group of voters when several voters lists participate -to a poll. - -Anonymous vote -++++++++++++++ - -The application allows to vote anonymously in case of polls based on restricted -list of voters. The anonymity is guaranteed for all the voters of the list. -In this case, the vote will be counted for the voter, but the application will -not link the voter to the vote. -Giving its identity when voting anonymously can annoy the voter. So in the case -of an anonymous vote, the voter will identify himself with a anonymity number. -The voter does not know how the application works for anonymous votes, this -approach will reinsure him regarding his anonymity. - -Functionalities (Use cases) -~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The application use case diagram in UML 2.0 format allows to present in a easy -and concise way the different application actors and functionalities. -As a reminder, the <<includes>> stereotype precise a use case decomposition with -a mandatory consideration of included use case, the <<extends>> stereotype -precise an optional functionality extension, the <<generalize>> stereotype makes -reference to the inheritance notion. - -There are 3 actors in the system : - -- The administrator manage users and can moderate polls. -- The user can manage a poll and vote -- The voter can vote. - -.. image:: schemas/UC_Gestiondesvotes.png - :alt: Functionalities - -The use cases "create a poll" (créer un sondage), "vote" (voter) and "count a -poll's votes" (dépouiller un sondage) will be explained in the following -paragraphs. - -Create a poll -+++++++++++++ - -The detailed scenario of poll creation. - -Actor : - -the user - -Pre-conditions : - -Base scenario : - -1. The user chose to create a poll. -2. The user chose the free poll type. -3. The user fill the poll title. -4. The user fill the poll description. -5. The user fill his name. -6. The user chose a end date for the poll. -7. The user chose the textual vote option type. -8. The user fill the different options in. -9. The user chose a unique choice poll. -10. The user validate the creation. -11. 2 URLs are automatically generated by the application : - One URL to administrate the poll. - One UTL to vote. -12. The user is invited to save those URLs. -13. An email is automatically sent by the application to the administrators -(who can moderate polls). - -Variations :: - - 1a. The user authenticate himself. - 1a1. If the user is black-listed, the connection is impossible, an error message is displayed. - 2a. The user chose a restricted type poll. - 2a1. The user chose a predefined list. - - The user can balance each voter of the list for the poll. - 2a2. The user chose several predefined lists (groups). - - The user can balance each voter of each group. - - The user can balance each group. - 2a3. The user chose to create a restricted list by filling in voters name and email address. - The user specifies if choices can be added by voters. - The user specifies if it is an anonymous poll. - 5a. If user is blacklisted, creation is not possible, an error message is shown. - 7a. The user chose to vote for dates. - 7b. The user chose to vote for images. - 9a. The user can chose a multiple choice poll is the number of option is more than 2. - The user chose the vote counting type. - 10a. If the user is authenticated or filled his email in, the system ask if the user wants to receive an email for each vote. - 11a. If the user filled in his email, an emails with the 2 poll's URLs is automatically sent to the poll creator. - 11b. If the user is authenticated, an email with the 2 poll's URLs is automatically sent when the poll is created. - 11c. In the case of a poll on a restricted list, an email with a link to vote and the voters login is sent to every voter of the poll. - 12a. The non authenticated user does not save the URLs : the user cannot reach the polls anymore. - 13a. If the poll is unvalidated by the administrator : the poll is deleted, the URL cannot be reached anymore. - If the user gave authentication information or is logged, he is blacklisted. - -Extensions :: - - 5a. The user gives his name and email. - 5a1. see variation 5a. - 10a. The user can write a comment before validating the poll. - -A figure of the actions based on the base scenario and its variations follows : - - -.. image:: schemas/CreerSondage.jpg - :alt: Create Poll part 1 - -.. image:: schemas/CreerSondage2.jpg - :alt: Create Poll part 2 - - -Vote -++++ - -Actor : - -Voter - -Pre-conditions : - -The voter knows the poll URL. -The poll is reachable. - -Base scenario : - -1. The voter connects to the poll from a URL. -2. The voter selects his choice(s). -3. The voter fills in his login. -4. The voter submits his vote. - -Variations :: - - 2a. If the poll is restricted and this option is authorised on the current poll, the voter can add a poll choice. The poll creator and all the participants are alerted by email of the poll modification. - 4a. If the voter did not filled in a valid login : an error message is shown, the vote is not counted. - 4b. If the voter is black listed by the poll creator, he is not allowed to vote : an error message is shown, the vote is not taken into account. - -Extensions :: - - 3a. The user fills in his vote login and email address. - 3b. The voter writes a comment on his vote. - 4a. The user receive a vote confirmation email. - 4b. The poll creator receives an email regarding the voter's vote. - 4c. The voter can modify his vote. - -.. image:: schemas/Voter.jpg - :alt: Vote - -Count the votes -+++++++++++++++ - -Actor - -The user - -Pre-conditions - -The poll ended. - -Base scenario : - -1. The user can connect to the poll by the URL. -2. The user chose to count the votes. -3. The application runs the vote counting algorithm. -4. The results (voters, answers) of the poll are displayed. - -Variations :: - - 1a. The user authenticate in the application and chose the poll from his polls list. - 1a1. see 1b - 1b. If the votes have already been counted, the results are displayed. - 2a. The votes are automatically counted when the poll's end date is reached. - 4a. In the case of a poll with an anonymous list of voters : the voters informations are not displayed. - -Extensions :: - - 4a. The result can be exported to XML format. - -The interactions chronology between the different entities defined in the analysis -step is presented in the following sequence diagram : - -.. image:: schemas/Depouiller.jpg - :alt: Base scenario - -.. image:: schemas/Depouiller_1a.jpg - :alt: Variation 1a - -Non functional requirements -~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The application does not need to only follow the requirements stated in the -project specifications. Several constraints have to be studied. - -Those constraints are : - -- The system have to store and restore manipulated informations : a DBMS use will -manage those needs. -- The application will not by strongly linked to any DBMS on the market : the -use of a persistence layer is mandatory. -- The application have to be service oriented, all the business layer will be -separated from the presentation layer. -- The system have to insure full security to the user for transactions done from -and to the server and in the software use itself. This implies a proper right -management at the application level. - -The business classes -~~~~~~~~~~~~~~~~~~~~ - -The analysis process gives the data part of the application's coherent class diagram. -This diagram will be the base for the implementation of the database scheme. - -.. image:: schemas/DC_Pollen.png - :alt: analysis class diagram. - -**Classes and associated comment** : - -- PollType, Poll type. -- ChoiceType, Choice type. -- VoteCounting, Vote count type. -- UserAccount, User logged in the application. -- PollAccount, Account for a poll, gather the voter and poll creator notion. -- PersonList, Predefined list of accounts. -- VotingList, Voters list. -- PersonToList, Voters from a list. -- Vote, Vote. -- Choice, Vote choice. -- VoteToChoice, Choice value when using preference order in a multichoice poll. - -**Result class** (poll results) : - -Attribute : - -- byGroup, Indicate that the votes have been counted by groups. - -**Poll class** (poll) : - -Attributes : - -- pollId, unique poll id. -- beginChoiceDate, Choice adding begin date. -- maxChoiceNb, Maximum choice number for a voter. -- choiceAddAllowed, Allow adding choices to poll. -- closed, Indicate that the poll is closed. -- anonymous, Poll with anonymous votes and voters. -- anonymousVoteAllowed, Anonymous vote allowed. -- publicResults, Indicate wether the poll's results are public or not. -- continuousResults, Indicate wether the polls results are visible while people -are voting. - -**PreventRule class** (notification rules) : - -Notification rules associated to the polls. They are used to execute actions -(message displaying, email sending,...) depending on various criteria. - -Attributes : - -- method, action to launch. -- scope, context in which the action can be launched. -- sensibility, value firing the action launch. -- active, Indicate if the rule is active -- oneTime, Indicate if the action can be launched only one time (the rule is -unactivated after its first launch). -- repeated, Indicate if the action can be launched repeatedly (an action with -sensibility 2 will be launch for values 2, 4, 6, 8, ...). - -.. image:: schemas/DC_PreventRules.png - :alt: Poll's lifecycle. - -The PreventRuleMAnager class allows to manage notifications rules. When the -*execute()* method is called, the method defined by the rule is executed if its -sensibility and context are valid. - -Example : Display a message every 100 votes :: - - // Define a rule : context : "vote", sensibility 100, repeatable - PreventRuleDTO preventRule = new PreventRuleDTO("vote", 100, true, - PreventRuleManager.PRINT_ACTION); - PreventRuleManager manager = new PreventRuleManager(preventRule); - - // We launch the execution by precising a context and a sensibility - // The manager verifies if the action have to be executed regarding the rule - // and the parameters. - manager.execute("vote",100,"un message"); // display "un message" - manager.execute("vote",200,"autre message"); // display "autre message" - - // Examples doing nothing - manager.execute("scope",100); // "scope" is not the right context - manager.execute("vote",50); // 50 is not the right sensibility - -Notifications are used in Pollen to send confirmation message when creating an -account, alert a poll creator when they are new votes or remind people they did -not vote... - -Poll's lifecycle -~~~~~~~~~~~~~~~~ - -At the beginning, a poll had only two states : open and closed, to which the -begin and end dates notion was linked. Once it was possible to add choices to a -poll, it has been necessary to add a begin and end date for choice adding and -the states describes in the following figure : - -.. image:: schemas/DET_PollState.png - :alt: Poll's lifecycle +Analysis +======== + +:Author: Erwan NEMA <nemawan@hotmail.com> +:Author: Nolwenn Rannou <rannou@codelutin.com> +:Revision: $Revision: 2773 $ +:Date: $Date: 2009-09-09 12:05:20 +0200 (mer., 09 sept. 2009) $ + +The needs +~~~~~~~~~ + +Pollen project is aimed to create a libre poll application with a web interface +and more functionalities regarding the other similar application already existing. +The principle is : a user create a poll and then send the link to the voters. +He can then follow the poll progression online. The voters vote by filling their +name and their vote. + +The poll creation have to be easy but allow the following operations : + +- define voters lists +- chose the vote counting principle (percentage, Condorcet,...) +- allow every voter to add new choices +- vote anonymously if we use a restricted list of voters +- send reminders to people who did not vote (if restricted voters list) +- define begin and end dates for polls. +- define the number of votes possible per person (1 choice or N choices amongst the propositions) +- be able to add a global comment or to his vote. +- define, before the vote, the weight of each voter (if restricted voters list) +- represent graphically the poll results +- export a poll in a standard format (poll, voters lists, poll results) for exchanges with other poll tools. + +Global concepts +~~~~~~~~~~~~~~~ + +This paragraph presents the different concepts manipulated by the poll application. +The table represents this application's data table. + +- Poll (Poll) : a poll is a survey with is taken by participants (voters). The poll/survey can focus on a question with multi-answers, a date choice. +- Prevent rule (PreventRule) : management of poll end rules (voters quota, date before reminder, ...). +- Free poll (FreePoll) : the poll is available for anybody. +- Restricted poll (RestrictedPoll) : the poll is available only for the restricted list members. +- Group poll (GroupPoll) : the poll is available for members of more than one restricted list. +- Vote : answer from a voter to the question, this answer is stored before beeing processed, the voters identity is then known. +- Anonymous vote (AnonymousVote) : answer from a voter to the question asked without knowing the voter's identity. +- Vote counting type (VoteCounting) : Poll results utilizing, the vote counting can be done normally(just counting the votes), in the case of multiple choice with Condorcet method (a preference order is attributed to choice), or by attributing a percentage to each choice. +- Choice type (ChoiceType) : Define the question and so the answer/choice type (yes/no, hour choice, date choice, text, picture,...) +- User (User) : People managing the poll, this person can be logged in or not. +- Voter (VotingPerson): People voting in a poll. +- Poll creator (PollAccount): Person already logged in or not, creating a poll. +- Voters predefined list (PersonList) : Voters predefined list created by a user and stored in the system. This list can be the base for a voters restricted list. +- Voters list (VotingList) : List of voters participating in a poll. +- Voters list type (ListType) : +- Free voters list : Voters list, voters may not need to have an account on pollen. +- Restricted voters list (RestrictedVotingList): Voters restricted list, all the voters are known and will be identified from this list. +- Voting group (VotingGroup): Restricted list of voters that might be globally balanced when counting votes (ex : developers group) +- Global comment (Comment): Comment on the poll +- Local comment (Vote.comment): Comment on a vote. + +Vote counting types ++++++++++++++++++++ + +For first versions, we implement usual vote counting : + +- Simple or free vote : this is the vote for a single answer, each answer gets votes, the sum of the votes for each answer represent the poll results. +- Condorcet vote : the voter sort his choices by preference order (ex a>b>c), we compare each choice to the other votes by counting the won or lost duels, the results of this comparison represents the poll results. +- Grade balanced vote : each choice is graded (function of a scale), the sum of the grades per answer represents the poll results. + +Balancing ++++++++++ + +Each voter may not have the same weight in a vote, so this balancing will have +consequences when counting votes. The balancing of each voter is possible in a +restricted list. +It is also possible to balance group of voters when several voters lists participate +to a poll. + +Anonymous vote +++++++++++++++ + +The application allows to vote anonymously in case of polls based on restricted +list of voters. The anonymity is guaranteed for all the voters of the list. +In this case, the vote will be counted for the voter, but the application will +not link the voter to the vote. +Giving its identity when voting anonymously can annoy the voter. So in the case +of an anonymous vote, the voter will identify himself with a anonymity number. +The voter does not know how the application works for anonymous votes, this +approach will reinsure him regarding his anonymity. + +Functionalities (Use cases) +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The application use case diagram in UML 2.0 format allows to present in a easy +and concise way the different application actors and functionalities. +As a reminder, the <<includes>> stereotype precise a use case decomposition with +a mandatory consideration of included use case, the <<extends>> stereotype +precise an optional functionality extension, the <<generalize>> stereotype makes +reference to the inheritance notion. + +There are 3 actors in the system : + +- The administrator manage users and can moderate polls. +- The user can manage a poll and vote +- The voter can vote. + +.. image:: schemas/UC_Gestiondesvotes.png + :alt: Functionalities + +The use cases "create a poll" (créer un sondage), "vote" (voter) and "count a +poll's votes" (dépouiller un sondage) will be explained in the following +paragraphs. + +Create a poll ++++++++++++++ + +The detailed scenario of poll creation. + +Actor : + +the user + +Pre-conditions : + +Base scenario : + +1. The user chose to create a poll. +2. The user chose the free poll type. +3. The user fill the poll title. +4. The user fill the poll description. +5. The user fill his name. +6. The user chose a end date for the poll. +7. The user chose the textual vote option type. +8. The user fill the different options in. +9. The user chose a unique choice poll. +10. The user validate the creation. +11. 2 URLs are automatically generated by the application : + One URL to administrate the poll. + One UTL to vote. +12. The user is invited to save those URLs. +13. An email is automatically sent by the application to the administrators +(who can moderate polls). + +Variations :: + + 1a. The user authenticate himself. + 1a1. If the user is black-listed, the connection is impossible, an error message is displayed. + 2a. The user chose a restricted type poll. + 2a1. The user chose a predefined list. + - The user can balance each voter of the list for the poll. + 2a2. The user chose several predefined lists (groups). + - The user can balance each voter of each group. + - The user can balance each group. + 2a3. The user chose to create a restricted list by filling in voters name and email address. + The user specifies if choices can be added by voters. + The user specifies if it is an anonymous poll. + 5a. If user is blacklisted, creation is not possible, an error message is shown. + 7a. The user chose to vote for dates. + 7b. The user chose to vote for images. + 9a. The user can chose a multiple choice poll is the number of option is more than 2. + The user chose the vote counting type. + 10a. If the user is authenticated or filled his email in, the system ask if the user wants to receive an email for each vote. + 11a. If the user filled in his email, an emails with the 2 poll's URLs is automatically sent to the poll creator. + 11b. If the user is authenticated, an email with the 2 poll's URLs is automatically sent when the poll is created. + 11c. In the case of a poll on a restricted list, an email with a link to vote and the voters login is sent to every voter of the poll. + 12a. The non authenticated user does not save the URLs : the user cannot reach the polls anymore. + 13a. If the poll is unvalidated by the administrator : the poll is deleted, the URL cannot be reached anymore. + If the user gave authentication information or is logged, he is blacklisted. + +Extensions :: + + 5a. The user gives his name and email. + 5a1. see variation 5a. + 10a. The user can write a comment before validating the poll. + +A figure of the actions based on the base scenario and its variations follows : + + +.. image:: schemas/CreerSondage.jpg + :alt: Create Poll part 1 + +.. image:: schemas/CreerSondage2.jpg + :alt: Create Poll part 2 + + +Vote +++++ + +Actor : + +Voter + +Pre-conditions : + +The voter knows the poll URL. +The poll is reachable. + +Base scenario : + +1. The voter connects to the poll from a URL. +2. The voter selects his choice(s). +3. The voter fills in his login. +4. The voter submits his vote. + +Variations :: + + 2a. If the poll is restricted and this option is authorised on the current poll, the voter can add a poll choice. The poll creator and all the participants are alerted by email of the poll modification. + 4a. If the voter did not filled in a valid login : an error message is shown, the vote is not counted. + 4b. If the voter is black listed by the poll creator, he is not allowed to vote : an error message is shown, the vote is not taken into account. + +Extensions :: + + 3a. The user fills in his vote login and email address. + 3b. The voter writes a comment on his vote. + 4a. The user receive a vote confirmation email. + 4b. The poll creator receives an email regarding the voter's vote. + 4c. The voter can modify his vote. + +.. image:: schemas/Voter.jpg + :alt: Vote + +Count the votes ++++++++++++++++ + +Actor + +The user + +Pre-conditions + +The poll ended. + +Base scenario : + +1. The user can connect to the poll by the URL. +2. The user chose to count the votes. +3. The application runs the vote counting algorithm. +4. The results (voters, answers) of the poll are displayed. + +Variations :: + + 1a. The user authenticate in the application and chose the poll from his polls list. + 1a1. see 1b + 1b. If the votes have already been counted, the results are displayed. + 2a. The votes are automatically counted when the poll's end date is reached. + 4a. In the case of a poll with an anonymous list of voters : the voters informations are not displayed. + +Extensions :: + + 4a. The result can be exported to XML format. + +The interactions chronology between the different entities defined in the analysis +step is presented in the following sequence diagram : + +.. image:: schemas/Depouiller.jpg + :alt: Base scenario + +.. image:: schemas/Depouiller_1a.jpg + :alt: Variation 1a + +Non functional requirements +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The application does not need to only follow the requirements stated in the +project specifications. Several constraints have to be studied. + +Those constraints are : + +- The system have to store and restore manipulated informations : a DBMS use will manage those needs. +- The application will not by strongly linked to any DBMS on the market : the use of a persistence layer is mandatory. +- The application have to be service oriented, all the business layer will be separated from the presentation layer. +- The system have to insure full security to the user for transactions done from and to the server and in the software use itself. This implies a proper right management at the application level. + +The business classes +~~~~~~~~~~~~~~~~~~~~ + +The analysis process gives the data part of the application's coherent class diagram. +This diagram will be the base for the implementation of the database scheme. + +.. image:: schemas/DC_Pollen.png + :alt: analysis class diagram. + +**Classes and associated comment** : + +- PollType, Poll type. +- ChoiceType, Choice type. +- VoteCounting, Vote count type. +- UserAccount, User logged in the application. +- PollAccount, Account for a poll, gather the voter and poll creator notion. +- PersonList, Predefined list of accounts. +- VotingList, Voters list. +- PersonToList, Voters from a list. +- Vote, Vote. +- Choice, Vote choice. +- VoteToChoice, Choice value when using preference order in a multichoice poll. + +**Result class** (poll results) : + +Attribute : + +- byGroup, Indicate that the votes have been counted by groups. + +**Poll class** (poll) : + +Attributes : + +- pollId, unique poll id. +- beginChoiceDate, Choice adding begin date. +- maxChoiceNb, Maximum choice number for a voter. +- choiceAddAllowed, Allow adding choices to poll. +- closed, Indicate that the poll is closed. +- anonymous, Poll with anonymous votes and voters. +- anonymousVoteAllowed, Anonymous vote allowed. +- publicResults, Indicate wether the poll's results are public or not. +- continuousResults, Indicate wether the polls results are visible while people are voting. + +**PreventRule class** (notification rules) : + +Notification rules associated to the polls. They are used to execute actions +(message displaying, email sending,...) depending on various criteria. + +Attributes : + +- method, action to launch. +- scope, context in which the action can be launched. +- sensibility, value firing the action launch. +- active, Indicate if the rule is active +- oneTime, Indicate if the action can be launched only one time (the rule is unactivated after its first launch). +- repeated, Indicate if the action can be launched repeatedly (an action with sensibility 2 will be launch for values 2, 4, 6, 8, ...). + +.. image:: schemas/DC_PreventRules.png + :alt: Poll's lifecycle. + +The PreventRuleMAnager class allows to manage notifications rules. When the +*execute()* method is called, the method defined by the rule is executed if its +sensibility and context are valid. + +Example : Display a message every 100 votes :: + + // Define a rule : context : "vote", sensibility 100, repeatable + PreventRuleDTO preventRule = new PreventRuleDTO("vote", 100, true, + PreventRuleManager.PRINT_ACTION); + PreventRuleManager manager = new PreventRuleManager(preventRule); + + // We launch the execution by precising a context and a sensibility + // The manager verifies if the action have to be executed regarding the rule + // and the parameters. + manager.execute("vote",100,"un message"); // display "un message" + manager.execute("vote",200,"autre message"); // display "autre message" + + // Examples doing nothing + manager.execute("scope",100); // "scope" is not the right context + manager.execute("vote",50); // 50 is not the right sensibility + +Notifications are used in Pollen to send confirmation message when creating an +account, alert a poll creator when they are new votes or remind people they did +not vote... + +Poll's lifecycle +~~~~~~~~~~~~~~~~ + +At the beginning, a poll had only two states : open and closed, to which the +begin and end dates notion was linked. Once it was possible to add choices to a +poll, it has been necessary to add a begin and end date for choice adding and +the states describes in the following figure : + +.. image:: schemas/DET_PollState.png + :alt: Poll's lifecycle
participants (1)
-
jcouteau@users.chorem.org