org.chorem.pollen.votecounting.services
Class ImportExportService

java.lang.Object
  extended by org.chorem.pollen.votecounting.services.ImportExportService

public class ImportExportService
extends Object

Service to import / export a poll to or from his xml representation.

Since:
1.3
Author:
tchemit

Field Summary
static String ANONYMOUS
           
static String ANONYMOUS_VOTE_ALLOWED
           
static String CHOICE
           
static String CHOICE_ADD_ALLOWED
           
static String CHOICE_RESULT
           
static String CHOICE_TYPE
           
static String CHOICES
           
static String CLOSED
           
static String COMMENT
           
static String COMMENTS
           
static String CONTINUOUS_RESULTS
           
static String CREATOR_EMAIL
           
static String CREATOR_ID
           
static String DESCRIPTION
           
static String EMAIL
           
static String GROUP
           
static String GROUPS
           
static String ID_CHOICE
           
static String ID_GROUP
           
static String ID_POLL
           
static String IS_BY_GROUP
           
static String MAX_CHOICE_NB
           
static String NAME
           
static String NB_VOTES
           
static String PERCENTAGE
           
static String POLL
           
static String POLL_CHOICE
           
static String POLL_CHOICES
           
static String POLL_EXPORT
           
static String POLL_ID
           
static String POLL_TYPE
           
static String PUBLIC_RESULTS
           
static String TITLE
           
static String TITLE1
           
static String VALUE
           
static String VALUE_FALSE
           
static String VALUE_TRUE
           
static String VOTE_COUNTING
           
static String VOTE_COUNTING_RESULT
           
static String VOTE_COUNTING_RESULTS
           
static String VOTING_ID
           
static String VOTING_PERSON
           
static String VOTING_PERSONS
           
static String WEIGHT
           
 
Constructor Summary
ImportExportService()
           
 
Method Summary
 String exportToXml(PollExportDTO exportPoll)
          Export the given poll to an xml representation.
 PollExportDTO importFromXml(File file)
          Import into a PollExportDTO his xml representation from the given file.
protected  List<ChoiceDTO> toChoices(List<org.jdom.Element> listChoices)
           
protected  List<CommentDTO> toComments(List<org.jdom.Element> listComments)
           
protected  org.jdom.Element toDOM(ChoiceDTO choice)
           
protected  org.jdom.Element toDOM(CommentDTO comment)
           
protected  org.jdom.Element toDOM(PollChoiceDTO pollChoice)
           
protected  org.jdom.Document toDOM(PollExportDTO exportPoll)
           
protected  org.jdom.Element toDOM(VoteCountingResultDTO voteCountingResults)
           
protected  org.jdom.Element toDOM(VotingGroupDTO group)
           
protected  org.jdom.Element toDOM(VotingPersonDTO votingPerson)
           
protected  PollExportDTO toDTO(org.jdom.Element racine)
           
protected  List<PollChoiceDTO> toPollChoices(List<org.jdom.Element> listPollChoices)
           
protected  List<VoteCountingResultDTO> toVoteCountingResults(List<org.jdom.Element> listVoteCountingResults)
           
protected  List<VoteToChoiceDTO> toVoteToChoices(List<org.jdom.Element> listVoteToChoices)
           
protected  List<VotingGroupDTO> toVotingGroups(List<org.jdom.Element> listGroups)
           
protected  List<VotingPersonDTO> toVotingPersons(List<org.jdom.Element> listVotingPersons)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POLL

public static final String POLL
See Also:
Constant Field Values

TITLE1

public static final String TITLE1
See Also:
Constant Field Values

TITLE

public static final String TITLE
See Also:
Constant Field Values

CHOICE

public static final String CHOICE
See Also:
Constant Field Values

ID_CHOICE

public static final String ID_CHOICE
See Also:
Constant Field Values

VALUE

public static final String VALUE
See Also:
Constant Field Values

PERCENTAGE

public static final String PERCENTAGE
See Also:
Constant Field Values

NB_VOTES

public static final String NB_VOTES
See Also:
Constant Field Values

IS_BY_GROUP

public static final String IS_BY_GROUP
See Also:
Constant Field Values

CHOICES

public static final String CHOICES
See Also:
Constant Field Values

CHOICE_RESULT

public static final String CHOICE_RESULT
See Also:
Constant Field Values

ID_POLL

public static final String ID_POLL
See Also:
Constant Field Values

VOTE_COUNTING_RESULT

public static final String VOTE_COUNTING_RESULT
See Also:
Constant Field Values

DESCRIPTION

public static final String DESCRIPTION
See Also:
Constant Field Values

NAME

public static final String NAME
See Also:
Constant Field Values

POLL_CHOICE

public static final String POLL_CHOICE
See Also:
Constant Field Values

VOTING_PERSON

public static final String VOTING_PERSON
See Also:
Constant Field Values

VOTING_ID

public static final String VOTING_ID
See Also:
Constant Field Values

WEIGHT

public static final String WEIGHT
See Also:
Constant Field Values

EMAIL

public static final String EMAIL
See Also:
Constant Field Values

COMMENT

public static final String COMMENT
See Also:
Constant Field Values

VOTING_PERSONS

public static final String VOTING_PERSONS
See Also:
Constant Field Values

ID_GROUP

public static final String ID_GROUP
See Also:
Constant Field Values

GROUP

public static final String GROUP
See Also:
Constant Field Values

POLL_CHOICES

public static final String POLL_CHOICES
See Also:
Constant Field Values

VOTE_COUNTING_RESULTS

public static final String VOTE_COUNTING_RESULTS
See Also:
Constant Field Values

GROUPS

public static final String GROUPS
See Also:
Constant Field Values

COMMENTS

public static final String COMMENTS
See Also:
Constant Field Values

CREATOR_ID

public static final String CREATOR_ID
See Also:
Constant Field Values

CREATOR_EMAIL

public static final String CREATOR_EMAIL
See Also:
Constant Field Values

MAX_CHOICE_NB

public static final String MAX_CHOICE_NB
See Also:
Constant Field Values

POLL_EXPORT

public static final String POLL_EXPORT
See Also:
Constant Field Values

POLL_ID

public static final String POLL_ID
See Also:
Constant Field Values

POLL_TYPE

public static final String POLL_TYPE
See Also:
Constant Field Values

CHOICE_TYPE

public static final String CHOICE_TYPE
See Also:
Constant Field Values

VOTE_COUNTING

public static final String VOTE_COUNTING
See Also:
Constant Field Values

CLOSED

public static final String CLOSED
See Also:
Constant Field Values

CHOICE_ADD_ALLOWED

public static final String CHOICE_ADD_ALLOWED
See Also:
Constant Field Values

ANONYMOUS_VOTE_ALLOWED

public static final String ANONYMOUS_VOTE_ALLOWED
See Also:
Constant Field Values

ANONYMOUS

public static final String ANONYMOUS
See Also:
Constant Field Values

PUBLIC_RESULTS

public static final String PUBLIC_RESULTS
See Also:
Constant Field Values

CONTINUOUS_RESULTS

public static final String CONTINUOUS_RESULTS
See Also:
Constant Field Values

VALUE_TRUE

public static final String VALUE_TRUE
See Also:
Constant Field Values

VALUE_FALSE

public static final String VALUE_FALSE
See Also:
Constant Field Values
Constructor Detail

ImportExportService

public ImportExportService()
Method Detail

exportToXml

public String exportToXml(PollExportDTO exportPoll)
Export the given poll to an xml representation.

Parameters:
exportPoll - the poll to export
Returns:
the xml representation of the given poll

importFromXml

public PollExportDTO importFromXml(File file)
                            throws org.jdom.JDOMException,
                                   IOException
Import into a PollExportDTO his xml representation from the given file.

Parameters:
file - file to load
Returns:
the loaded dto from the xml representation.
Throws:
org.jdom.JDOMException - if could not load xml from file
IOException - if could not load the file

toDTO

protected PollExportDTO toDTO(org.jdom.Element racine)

toComments

protected List<CommentDTO> toComments(List<org.jdom.Element> listComments)

toVotingGroups

protected List<VotingGroupDTO> toVotingGroups(List<org.jdom.Element> listGroups)

toVotingPersons

protected List<VotingPersonDTO> toVotingPersons(List<org.jdom.Element> listVotingPersons)

toVoteToChoices

protected List<VoteToChoiceDTO> toVoteToChoices(List<org.jdom.Element> listVoteToChoices)

toPollChoices

protected List<PollChoiceDTO> toPollChoices(List<org.jdom.Element> listPollChoices)

toVoteCountingResults

protected List<VoteCountingResultDTO> toVoteCountingResults(List<org.jdom.Element> listVoteCountingResults)

toChoices

protected List<ChoiceDTO> toChoices(List<org.jdom.Element> listChoices)

toDOM

protected org.jdom.Document toDOM(PollExportDTO exportPoll)

toDOM

protected org.jdom.Element toDOM(CommentDTO comment)

toDOM

protected org.jdom.Element toDOM(VotingGroupDTO group)

toDOM

protected org.jdom.Element toDOM(VotingPersonDTO votingPerson)

toDOM

protected org.jdom.Element toDOM(PollChoiceDTO pollChoice)

toDOM

protected org.jdom.Element toDOM(VoteCountingResultDTO voteCountingResults)

toDOM

protected org.jdom.Element toDOM(ChoiceDTO choice)


Copyright © 2009-2012 CodeLutin. All Rights Reserved.