r2859 - in trunk: pollen-business/src/main/java/org/chorem/pollen/business/converters pollen-business/src/main/java/org/chorem/pollen/business/dto pollen-ui pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/business pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/dto pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/services
Author: jruchaud Date: 2010-02-09 14:50:24 +0100 (Tue, 09 Feb 2010) New Revision: 2859 Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataChoiceConverter.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataResultConverter.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataVoteCountingConverter.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ChoiceDTO.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ResultDTO.java trunk/pollen-ui/ trunk/pollen-ui/pom.xml trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/business/NumberMethod.java trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/dto/PollChoiceDTO.java trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/services/ServiceExportImpl.java Log: #110 Suppression du contenu m?\195?\169tier dans les DTO Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataChoiceConverter.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataChoiceConverter.java 2010-02-04 12:48:09 UTC (rev 2858) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataChoiceConverter.java 2010-02-09 13:50:24 UTC (rev 2859) @@ -25,6 +25,7 @@ import org.chorem.pollen.business.persistence.Poll; import org.chorem.pollen.business.persistence.PollDAO; import org.chorem.pollen.business.persistence.PollenModelDAOHelper; +import org.chorem.pollen.votecounting.business.NumberMethod; import org.nuiton.topia.TopiaException; /** @@ -64,7 +65,10 @@ public ChoiceDTO createChoiceDTO(Choice eChoice) { ChoiceDTO choiceDTO = new ChoiceDTO(); choiceDTO.setId(eChoice.getTopiaId()); - choiceDTO.setName(eChoice.getName()); + String eChoiceName = eChoice.getName(); + choiceDTO.setName(eChoiceName); + choiceDTO.setHidden(eChoiceName != null + && eChoiceName.startsWith(NumberMethod.HIDDEN_PREFIX)); choiceDTO.setDescription(eChoice.getDescription()); choiceDTO.setValidate(eChoice.getValidate()); Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataResultConverter.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataResultConverter.java 2010-02-04 12:48:09 UTC (rev 2858) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataResultConverter.java 2010-02-09 13:50:24 UTC (rev 2859) @@ -27,6 +27,7 @@ import org.chorem.pollen.business.persistence.PollenModelDAOHelper; import org.chorem.pollen.business.persistence.Result; import org.chorem.pollen.business.persistence.ResultDAO; +import org.chorem.pollen.votecounting.business.NumberMethod; import org.chorem.pollen.votecounting.dto.ChoiceDTO; import org.chorem.pollen.votecounting.dto.VoteCountingResultDTO; import org.nuiton.topia.TopiaContext; @@ -87,7 +88,10 @@ ResultDTO dto = new ResultDTO(); dto.setId(res.getTopiaId()); dto.setPollId(ePoll.getPollId()); - dto.setName(res.getName()); + String resName = res.getName(); + dto.setName(resName); + dto.setHidden(resName != null && + resName.startsWith(NumberMethod.HIDDEN_PREFIX)); dto.setValue(res.getResultValue()); dto.setByGroup(res.getByGroup()); dto.setChoiceType(EnumController.getChoiceType(ePoll)); Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataVoteCountingConverter.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataVoteCountingConverter.java 2010-02-04 12:48:09 UTC (rev 2858) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataVoteCountingConverter.java 2010-02-09 13:50:24 UTC (rev 2859) @@ -26,6 +26,7 @@ import org.chorem.pollen.business.persistence.VotingList; import org.chorem.pollen.business.services.ServicePollAccount; import org.chorem.pollen.business.services.ServicePollAccountImpl; +import org.chorem.pollen.votecounting.business.NumberMethod; import org.chorem.pollen.votecounting.dto.CommentDTO; import org.chorem.pollen.votecounting.dto.PollChoiceDTO; import org.chorem.pollen.votecounting.dto.PollDTO; @@ -99,7 +100,10 @@ private static PollChoiceDTO createPollChoiceDTO(Choice choice) { PollChoiceDTO choiceDTO = new PollChoiceDTO(choice.getTopiaId()); - choiceDTO.setName(choice.getName()); + String choiceName = choice.getName(); + choiceDTO.setName(choiceName); + choiceDTO.setHidden(choiceName != null && + choiceName.startsWith(NumberMethod.HIDDEN_PREFIX)); choiceDTO.setDescription(choice.getDescription()); return choiceDTO; } @@ -203,7 +207,10 @@ private static org.chorem.pollen.business.dto.ChoiceDTO createPollChoiceDTO( PollChoiceDTO pollChoiceDTO) { org.chorem.pollen.business.dto.ChoiceDTO bChoiceDTO = new org.chorem.pollen.business.dto.ChoiceDTO(); - bChoiceDTO.setName(pollChoiceDTO.getName()); + String pollChoiceName = pollChoiceDTO.getName(); + bChoiceDTO.setName(pollChoiceName); + bChoiceDTO.setHidden(pollChoiceName != null + && pollChoiceName.startsWith(NumberMethod.HIDDEN_PREFIX)); bChoiceDTO.setDescription(pollChoiceDTO.getDescription()); return bChoiceDTO; } Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ChoiceDTO.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ChoiceDTO.java 2010-02-04 12:48:09 UTC (rev 2858) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ChoiceDTO.java 2010-02-09 13:50:24 UTC (rev 2859) @@ -29,8 +29,6 @@ */ public class ChoiceDTO implements Serializable { - public static final String HIDDEN_PREFIX = PollChoiceDTO.HIDDEN_PREFIX; - private static final long serialVersionUID = 1L; private String id = ""; @@ -47,6 +45,8 @@ private String pollId = ""; + private boolean hidden = false; + public ChoiceDTO() { } @@ -118,11 +118,10 @@ } public boolean isHidden() { - if (name != null) { - return name.startsWith(HIDDEN_PREFIX); - } - - return false; + return hidden; } + public void setHidden(boolean hidden) { + this.hidden = hidden; + } } \ No newline at end of file Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ResultDTO.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ResultDTO.java 2010-02-04 12:48:09 UTC (rev 2858) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/dto/ResultDTO.java 2010-02-09 13:50:24 UTC (rev 2859) @@ -44,6 +44,8 @@ private boolean byGroup = false; + private boolean hidden = false; + public ResultDTO() { } @@ -118,10 +120,10 @@ } public boolean isHidden() { - if (name != null) { - return name.startsWith(ChoiceDTO.HIDDEN_PREFIX); - } - - return false; + return hidden; } + + public void setHidden(boolean hidden) { + this.hidden = hidden; + } } \ No newline at end of file Property changes on: trunk/pollen-ui ___________________________________________________________________ Modified: svn:ignore - target .classpath .project .settings *.ipr *.iws *.iml .pollen + target .classpath .project .settings *.ipr *.iws *.iml .pollen profiles.xml Modified: trunk/pollen-ui/pom.xml =================================================================== --- trunk/pollen-ui/pom.xml 2010-02-04 12:48:09 UTC (rev 2858) +++ trunk/pollen-ui/pom.xml 2010-02-09 13:50:24 UTC (rev 2859) @@ -97,6 +97,7 @@ <properties> <redmine.releaseFiles>target/${project.build.finalName}.war</redmine.releaseFiles> + <netbeans.hint.deploy.server>gfv3ee6</netbeans.hint.deploy.server> </properties> <reporting> @@ -116,7 +117,7 @@ <build> <!-- call result war : pollen-xxx.war --> <finalName>pollen-${project.version}</finalName> - + <!-- Add main class into war to make it executable --> <plugins> <plugin> @@ -135,7 +136,7 @@ <includes> <include>**/war/Winstone*</include> </includes> - </overlay> + </overlay> <overlay> <groupId>org.jvnet.hudson.winstone</groupId> <artifactId>winstone</artifactId> @@ -178,3 +179,4 @@ </repository> </repositories> </project> + Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java 2010-02-04 12:48:09 UTC (rev 2858) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java 2010-02-09 13:50:24 UTC (rev 2859) @@ -56,6 +56,7 @@ import org.chorem.pollen.ui.components.ImageContextLink; import org.chorem.pollen.ui.data.Lien; import org.chorem.pollen.ui.services.Configuration; +import org.chorem.pollen.votecounting.business.NumberMethod; import org.chorem.pollen.votecounting.dto.VoteCountingResultDTO; import org.slf4j.Logger; @@ -399,7 +400,8 @@ if (result.isHidden()) { String name = result.getName(); int indexOf = name.indexOf('#'); - String choice = name.substring(ChoiceDTO.HIDDEN_PREFIX.length(), indexOf); + String choice = name.substring( + NumberMethod.HIDDEN_PREFIX.length(), indexOf); List<String> votes = choicesResults.get(choice); if (votes == null) { Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java 2010-02-04 12:48:09 UTC (rev 2858) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java 2010-02-09 13:50:24 UTC (rev 2859) @@ -79,6 +79,7 @@ import org.chorem.pollen.ui.services.Configuration; import org.chorem.pollen.ui.utils.FeedUtil; import org.chorem.pollen.ui.utils.ImageUtil; +import org.chorem.pollen.votecounting.business.NumberMethod; import org.slf4j.Logger; /** @@ -344,8 +345,9 @@ // creates a new hidden choice ChoiceDTO hiddenChoice = new ChoiceDTO(); - hiddenChoice.setName(ChoiceDTO.HIDDEN_PREFIX + + hiddenChoice.setName(NumberMethod.HIDDEN_PREFIX + choice.getName() + "#" + votingId); + hiddenChoice.setHidden(true); hiddenChoice.setValue(choice.getValue()); hiddenChoice.setPollId(choice.getPollId()); hiddenChoice.setVoteId(choice.getVoteId()); Modified: trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/business/NumberMethod.java =================================================================== --- trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/business/NumberMethod.java 2010-02-04 12:48:09 UTC (rev 2858) +++ trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/business/NumberMethod.java 2010-02-09 13:50:24 UTC (rev 2859) @@ -11,7 +11,10 @@ * @since 1.2.2 */ public class NumberMethod implements Method { - + + /** Permet de rajouter des choix cachés */ + public static final String HIDDEN_PREFIX = "HIDDEN_"; + @Override public void executeCounting(List<Choice> choices, boolean byGroup) { Modified: trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/dto/PollChoiceDTO.java =================================================================== --- trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/dto/PollChoiceDTO.java 2010-02-04 12:48:09 UTC (rev 2858) +++ trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/dto/PollChoiceDTO.java 2010-02-09 13:50:24 UTC (rev 2859) @@ -22,24 +22,26 @@ * @version $Id$ */ public class PollChoiceDTO { - public static final String HIDDEN_PREFIX = "HIDDEN_"; - private String idChoice; private String name; private String description; + private boolean hidden; + public PollChoiceDTO(String idChoice) { this.idChoice = idChoice; this.name = ""; this.description = ""; + this.hidden = false; } public PollChoiceDTO(int idChoice) { this.idChoice = String.valueOf(idChoice); this.name = ""; this.description = ""; + this.hidden = false; } public String getIdChoice() { @@ -67,10 +69,10 @@ } public boolean isHidden() { - if (name != null) { - return name.startsWith(HIDDEN_PREFIX); - } - - return false; + return hidden; } + + public void setHidden(boolean hidden) { + this.hidden = hidden; + } } \ No newline at end of file Modified: trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/services/ServiceExportImpl.java =================================================================== --- trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/services/ServiceExportImpl.java 2010-02-04 12:48:09 UTC (rev 2858) +++ trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/services/ServiceExportImpl.java 2010-02-09 13:50:24 UTC (rev 2859) @@ -27,6 +27,7 @@ import org.chorem.pollen.common.ChoiceType; import org.chorem.pollen.common.PollType; import org.chorem.pollen.common.VoteCountingType; +import org.chorem.pollen.votecounting.business.NumberMethod; import org.chorem.pollen.votecounting.dto.ChoiceDTO; import org.chorem.pollen.votecounting.dto.CommentDTO; import org.chorem.pollen.votecounting.dto.PollChoiceDTO; @@ -529,7 +530,12 @@ Element pollChoiceElm = (Element) i.next(); PollChoiceDTO pollChoice = new PollChoiceDTO(pollChoiceElm .getAttributeValue("idChoice")); - pollChoice.setName(pollChoiceElm.getChild("name").getValue()); + + String pollChoiceName = pollChoiceElm.getChild("name").getValue(); + pollChoice.setName(pollChoiceName); + pollChoice.setHidden(pollChoiceName != null + && pollChoiceName.startsWith(NumberMethod.HIDDEN_PREFIX)); + pollChoice.setDescription(pollChoiceElm.getChild("description") .getValue());
participants (1)
-
jruchaud@users.chorem.org