Author: tchemit Date: 2012-10-01 06:06:59 +0200 (Mon, 01 Oct 2012) New Revision: 3714 Url: http://chorem.org/repositories/revision/pollen/3714 Log: clean some code Modified: trunk/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/Polls.java trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultForPoll.java trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/result.jsp Modified: trunk/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/Polls.java =================================================================== --- trunk/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/Polls.java 2012-09-30 16:09:37 UTC (rev 3713) +++ trunk/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/Polls.java 2012-10-01 04:06:59 UTC (rev 3714) @@ -26,13 +26,13 @@ import com.google.common.base.Preconditions; import com.google.common.collect.Maps; import org.chorem.pollen.PollenFunctions; +import org.chorem.pollen.votecounting.VoteCounting; +import org.chorem.pollen.votecounting.VoteCountingFactory; import org.chorem.pollen.votecounting.model.GroupOfVoter; import org.chorem.pollen.votecounting.model.GroupOfVoterBuilder; import org.chorem.pollen.votecounting.model.SimpleVoterBuilder; import org.chorem.pollen.votecounting.model.Voter; import org.chorem.pollen.votecounting.model.VoterBuilder; -import org.chorem.pollen.votecounting.VoteCounting; -import org.chorem.pollen.votecounting.VoteCountingFactory; import java.util.Map; import java.util.Set; @@ -45,18 +45,6 @@ */ public class Polls { - public static boolean isGroupPoll(Poll poll) { - return PollType.GROUP == poll.getPollType(); - } - - public static boolean isRestrictedPoll(Poll poll) { - return PollType.RESTRICTED == poll.getPollType(); - } - - public static boolean isFreePoll(Poll poll) { - return PollType.FREE == poll.getPollType(); - } - /** * Collect all vote for all voters of the givne poll. * <p/> Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultForPoll.java =================================================================== --- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultForPoll.java 2012-09-30 16:09:37 UTC (rev 3713) +++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultForPoll.java 2012-10-01 04:06:59 UTC (rev 3714) @@ -35,7 +35,6 @@ import org.chorem.pollen.business.persistence.ChoiceType; import org.chorem.pollen.business.persistence.Poll; import org.chorem.pollen.business.persistence.PollAccount; -import org.chorem.pollen.business.persistence.Polls; import org.chorem.pollen.business.persistence.VotingList; import org.chorem.pollen.services.impl.PollVoteCountingService; import org.chorem.pollen.ui.PollenUIUtils; @@ -162,7 +161,7 @@ public String getVoteUrl() { PollUrl url = getPollUrlService().getPollVoteUrl(poll); url.getPollUri().setAccountId(getUserSecurityContext().getAccountId()); - if (isFreePoll()) { + if (poll.isPollFree()) { // can removed accountId only for free poll //FIXME Should found out in ohter case the accountId (if exists for the connected id) if no accountId is given @@ -242,7 +241,7 @@ if (byGroup == null) { // nothing defined, use default value - byGroup = isGroupPoll(); + byGroup = poll.isPollGroup(); } choicesById = Maps.uniqueIndex(poll.getChoice(), TopiaId.GET_TOPIA_ID); @@ -252,7 +251,7 @@ PollVoteCountingService voteCountingService = getService(PollVoteCountingService.class); - if (isGroupPoll() && getByGroup()) { + if (poll.isPollGroup() && getByGroup()) { groupsById = Maps.newHashMap(); @@ -279,18 +278,6 @@ return SUCCESS; } - public boolean isFreePoll() { - return Polls.isFreePoll(poll); - } - - public boolean isRestrictedPoll() { - return Polls.isRestrictedPoll(poll); - } - - public boolean isGroupPoll() { - return Polls.isGroupPoll(poll); - } - public boolean isTextType() { return poll.getChoiceType() == ChoiceType.TEXT; } @@ -305,7 +292,7 @@ public String getNormalPollResultChartUrl(int width, int height) { String title; - if (isGroupPoll() && !getByGroup()) { + if (poll.isPollGroup() && !getByGroup()) { // means poll votecount as anot group poll title = _("pollen.common.pollResult.forPollAsNotGroupPoll"); Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/result.jsp =================================================================== --- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/result.jsp 2012-09-30 16:09:37 UTC (rev 3713) +++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/result.jsp 2012-10-01 04:06:59 UTC (rev 3714) @@ -48,11 +48,11 @@ chartUrls['chart_normal'] = "<s:url value='%{getNormalPollResultChartUrl(400, 300)}' escapeAmp='false'/>"; <s:if test="byGroup"> - //Add all result by group + //Add all result by group <s:iterator value="groupIds" var="groupId" status="status"> - chartUrls['chart_Group_<s:property value="#status.index"/>'] = "<s:url value='%{getGroupPollResultChartUrl(#groupId, 400, 300)}' escapeAmp='false'/>"; + chartUrls['chart_Group_<s:property value="#status.index"/>'] = "<s:url value='%{getGroupPollResultChartUrl(#groupId, 400, 300)}' escapeAmp='false'/>"; </s:iterator> - </s:if> + </s:if> <%--<s:if test="numberVoteCounting">--%> <%--<s:iterator value="choicesResultNames" var="choicesResultName" status="status">--%> <%--chartUrls['chart_<s:property value="#status.index"/>'] = "<s:url value='%{getChoicesResultCharUrl(400,300, #choicesResultName)}' escapeAmp='false'/>";--%> @@ -139,7 +139,7 @@ </div> <div class="displayTypeDiv"> - <s:if test="groupPoll"> + <s:if test="poll.pollGroup"> <s:text name="pollen.common.results"/> <s:if test="byGroup"> <s:a href="%{getResultUrl(false)}">