Author: fdesbois Date: 2012-03-27 13:28:43 +0200 (Tue, 27 Mar 2012) New Revision: 3211 Url: http://chorem.org/repositories/revision/pollen/3211 Log: - use PollUri object in AbstractPollUriIdAction - rename and implement EditVote action Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/EditVote.java Removed: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ModifyVote.java Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollUriIdAction.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractVoteAction.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ClosePoll.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteChoice.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteComment.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteVote.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmPollAction.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteChoice.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeletePoll.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteVote.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ExportPoll.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultForPoll.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-poll.xml branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollUriIdAction.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollUriIdAction.java 2012-03-27 11:28:36 UTC (rev 3210) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollUriIdAction.java 2012-03-27 11:28:43 UTC (rev 3211) @@ -23,48 +23,39 @@ */ package org.chorem.pollen.ui.actions.poll; -import org.apache.commons.lang3.StringUtils; +import org.chorem.pollen.bean.PollUri; import org.chorem.pollen.ui.actions.PollenActionSupport; /** * Abstract action for all actions with a poll uri id. * * @author tchemit <chemit@codelutin.com> + * @author fdesbois <fdesbois@codelutin.com> * @since 1.2.6 */ public abstract class AbstractPollUriIdAction extends PollenActionSupport { private static final long serialVersionUID = 1L; + + private PollUri pollUri; - /** Poll id (not topiaId but uuid, perharps we should use directly topiaId transformed to something smaller ?). */ - protected String pollId; - - /** Account id (not topiaId but uuid, perharps we should use directly topiaId transformed to something smaller ?). */ - protected String accountId; - public final String getUriId() { - String result = pollId; - if (StringUtils.isNotEmpty(accountId)) { - result += ":" + accountId; - } - return result; + return pollUri != null ? pollUri.getUri() : null; } public final void setUriId(String uriId) { - String[] split = uriId.split(":", 2); - if (split.length > 0) { - pollId = split[0]; - if (split.length > 1) { - accountId = split[1]; - } - } + pollUri = PollUri.newPollUri(uriId); } + public void prepareUriId(String pollId, String accountId) { + pollUri = PollUri.newPollUri(pollId, accountId); + } + public final String getPollId() { - return pollId; + return pollUri != null ? pollUri.getPollId() : null; } public final String getAccountId() { - return accountId; + return pollUri != null ? pollUri.getAccountId() : null; } } Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractVoteAction.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractVoteAction.java 2012-03-27 11:28:36 UTC (rev 3210) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractVoteAction.java 2012-03-27 11:28:43 UTC (rev 3211) @@ -34,7 +34,6 @@ import org.chorem.pollen.business.persistence.Comment; import org.chorem.pollen.business.persistence.Poll; import org.chorem.pollen.business.persistence.PollAccount; -import org.chorem.pollen.business.persistence.UserAccount; import org.chorem.pollen.business.persistence.Vote; import org.chorem.pollen.business.persistence.VoteToChoice; import org.chorem.pollen.common.ChoiceType; @@ -56,6 +55,7 @@ * Abstract action for actions on the vote poll page. * * @author tchemit <chemit@codelutin.com> + * @author fdesbois <fdesbois@codelutin.com> * @since 1.2.6 */ public abstract class AbstractVoteAction extends AbstractPollUriIdAction implements ParameterAware { @@ -152,12 +152,6 @@ return vote; } - public boolean getVoteValueAsBoolean(int index) { - VoteToChoice voteToChoice = getVote().getChoiceVoteToChoice().get(index); - Integer value = voteToChoice.getVoteValue(); - return value == 1; - } - public boolean isPollChoiceOrVoteStarted() { Date now = serviceContext.getCurrentTime(); return poll.isAddChoiceStarted(now) || poll.isStarted(now); @@ -287,8 +281,16 @@ DateFormat.SHORT, DateFormat.SHORT, getLocale())); - loadPollAccount(); - loadVotes(); + // Current poll account + pollAccount = getPollService().getPollAccount(getAccountId(), getPollenUserAccount()); + + // All votes + // TODO no pagination for the moment, need to retrieve the correct page depends on current pollAccount + votes = poll.getVote(); + + // Current vote + vote = getVoteService().getVote(poll, votes, pollAccount); + loadPollResults(); loadPollComments(); @@ -365,31 +367,7 @@ } public boolean isModifAllowed(String voteId) { - - boolean result = false; - - Vote vote = poll.getVoteByTopiaId(voteId); - - // can only modify a vote if poll is running. - if (vote != null && isPollRunning()) { - PollAccount votePollAccount = vote.getPollAccount(); - - // si le votant du vote correspond au votant actuel (pollAccountId) - if (accountId != null - && accountId.equals(votePollAccount.getAccountId())) { - result = true; - } - - UserAccount userAccount = getPollenUserAccount(); - - - // si l'utilisateur du vote correspond à l'utilisateur actuel (user) - if (userAccount != null) { - UserAccount voteUserAccount = votePollAccount.getUserAccount(); - result = voteUserAccount != null && userAccount.getTopiaId().equals(voteUserAccount.getTopiaId()); - } - } - return result; + return getVoteService().isUpdateAllowed(getPoll(), voteId, getAccountId(), getPollenUserAccount()); } public String escapeLineBreak(String text) { @@ -402,6 +380,7 @@ protected void loadPoll() throws PollNotFoundException { + String pollId = getPollId(); if (StringUtils.isNotEmpty(pollId)) { poll = getPollService().getPollByPollId(pollId); } @@ -421,76 +400,6 @@ } } - protected void loadPollAccount() throws PollNotFoundException { - - //// Contrôle et définition du votingId -// alreadyVoted = false; -// boolean modifAllowed = false; -// boolean restrictedListsForbidden = false; - - // Suppression des espaces pouvant provoquer un double vote - // TODO maybe it's better to keep current pollAccount instead of creating one each time - pollAccount = getPollService().getNewPollAccount(getPollenUserAccount()); -// String votingId = pollAccount.getVotingId().trim(); -// pollAccount.setVotingId(votingId); -// -// // The calcul of alreadyVoted will be needed for no double votingId -// // Carefull, not correct for an anonymous vote -// alreadyVoted = getVoteService().hasAlreadyVoted(votingId, poll); -// -// // Check for restricted poll -// if (!alreadyVoted && !isFreePoll()) { -// -// if (StringUtils.isNotEmpty(getAccountId())) { -// -// // The accountUId must be valid for the poll -// PollAccount restrictedAccount = -// getPollService().getRestrictedAccount(getPollId(), getAccountId()); -// -// if (restrictedAccount != null) { -// // PollAccount is replaced by the good account from db -// pollAccount = restrictedAccount; -// -// // Refresh alreadyVoted value depends on pollAccount -//// alreadyVoted = pollAccount.isHasVoted(); -// -// } else { -// // Existing account is null is forbidden for a restricted poll -// restrictedListsForbidden = true; -// } -// -// } else { -// // Not allowed to vote without an accountUId -// restrictedListsForbidden = true; -// } -// -// if (restrictedListsForbidden) { -// addActionError(_("pollen.error.user.restrictedListsForbidden")); -// } -// } -// -// // Génération d'un identifiant de vote (si le sondage est libre et anonyme) -// if (poll.isAnonymous() && isFreePoll()) { -// getPollAccount().setVotingId( -// "anonymous" + serviceContext.createPollenUrlId()); -// } -// -// modifAllowed = isModifAllowed(getPollAccount().getVotingId()); -// if (alreadyVoted && !modifAllowed) { -// addActionError(_("pollen.error.user.alreadyVoted", -// getPollAccount().getVotingId())); -// } - } - - protected void loadVotes() { - - // TODO no pagination for the moment, need to retrieve the correct page depends on current pollAccount - votes = getPoll().getVote(); - - // Current vote - vote = getVoteService().getVote(getPoll(), getVotes(), getPollAccount()); - } - protected void loadPollComments() { PollCommentService service = newService(PollCommentService.class); Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ClosePoll.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ClosePoll.java 2012-03-27 11:28:36 UTC (rev 3210) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ClosePoll.java 2012-03-27 11:28:43 UTC (rev 3211) @@ -50,7 +50,7 @@ PollService service = newService(PollService.class); - service.closePoll(pollId, getPollenUserAccount(), accountId); + service.closePoll(getPollId(), getPollenUserAccount(), getAccountId()); return SUCCESS; } } Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteChoice.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteChoice.java 2012-03-27 11:28:36 UTC (rev 3210) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteChoice.java 2012-03-27 11:28:43 UTC (rev 3211) @@ -53,6 +53,7 @@ @Override public String execute() throws Exception { + String pollId = getPollId(); Preconditions.checkNotNull(pollId); Preconditions.checkNotNull(choiceId); Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteComment.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteComment.java 2012-03-27 11:28:36 UTC (rev 3210) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteComment.java 2012-03-27 11:28:43 UTC (rev 3211) @@ -55,6 +55,7 @@ @Override public String execute() throws Exception { + String pollId = getPollId(); Preconditions.checkNotNull(pollId); Preconditions.checkNotNull(commentId); Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteVote.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteVote.java 2012-03-27 11:28:36 UTC (rev 3210) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteVote.java 2012-03-27 11:28:43 UTC (rev 3211) @@ -53,6 +53,7 @@ @Override public String execute() throws Exception { + String pollId = getPollId(); Preconditions.checkNotNull(pollId); Preconditions.checkNotNull(voteId); Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmPollAction.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmPollAction.java 2012-03-27 11:28:36 UTC (rev 3210) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmPollAction.java 2012-03-27 11:28:43 UTC (rev 3211) @@ -55,6 +55,7 @@ @Override public String execute() throws Exception { + String pollId = getPollId(); Preconditions.checkNotNull(pollId); poll = newService(PollService.class).getPollByPollId(pollId); return SUCCESS; Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteChoice.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteChoice.java 2012-03-27 11:28:36 UTC (rev 3210) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteChoice.java 2012-03-27 11:28:43 UTC (rev 3211) @@ -45,6 +45,7 @@ @Override public String execute() throws Exception { + String pollId = getPollId(); Preconditions.checkNotNull(pollId); Preconditions.checkNotNull(choiceId); Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeletePoll.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeletePoll.java 2012-03-27 11:28:36 UTC (rev 3210) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeletePoll.java 2012-03-27 11:28:43 UTC (rev 3211) @@ -50,7 +50,7 @@ PollService service = newService(PollService.class); - service.deletePoll(pollId, getPollenUserAccount(), accountId); + service.deletePoll(getPollId(), getPollenUserAccount(), getAccountId()); return SUCCESS; } Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteVote.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteVote.java 2012-03-27 11:28:36 UTC (rev 3210) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteVote.java 2012-03-27 11:28:43 UTC (rev 3211) @@ -45,7 +45,6 @@ @Override public String execute() throws Exception { - Preconditions.checkNotNull(pollId); Preconditions.checkNotNull(voteId); VoteService service = newService(VoteService.class); Copied: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/EditVote.java (from rev 3210, branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ModifyVote.java) =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/EditVote.java (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/EditVote.java 2012-03-27 11:28:43 UTC (rev 3211) @@ -0,0 +1,57 @@ +/* + * #%L + * Pollen :: UI (strust2) + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package org.chorem.pollen.ui.actions.poll; + +/** + * EditVote is a redirection to vote page. This action will simply update the + * uri with {@code accountId} and {@code pollId}. + * + * @author fdesbois <fdesbois@codelutin.com> + * @since 1.2.6 + * @see #prepareUriId(String, String) + */ +public class EditVote extends AbstractPollUriIdAction { + + private static final long serialVersionUID = 1L; + + private String accountId; + + private String pollId; + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public void setPollId(String pollId) { + this.pollId = pollId; + } + + @Override + public String execute() throws Exception { + + prepareUriId(pollId, accountId); + + return SUCCESS; + } +} Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ExportPoll.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ExportPoll.java 2012-03-27 11:28:36 UTC (rev 3210) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ExportPoll.java 2012-03-27 11:28:43 UTC (rev 3211) @@ -60,6 +60,7 @@ @Override public String execute() throws Exception { + String pollId = getPollId(); Preconditions.checkNotNull(pollId); PollResultsService service = newService(PollResultsService.class); Deleted: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ModifyVote.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ModifyVote.java 2012-03-27 11:28:36 UTC (rev 3210) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ModifyVote.java 2012-03-27 11:28:43 UTC (rev 3211) @@ -1,44 +0,0 @@ -/* - * #%L - * Pollen :: UI (strust2) - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2012 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ -package org.chorem.pollen.ui.actions.poll; - -/** - * TODO - * - * @author tchemit <chemit@codelutin.com> - * @since TODO - */ -public class ModifyVote extends AbstractVoteAction { - - private static final long serialVersionUID = 1L; - - - @Override - public String execute() throws Exception { - - loadPoll(); - - return SUCCESS; - } -} Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultForPoll.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultForPoll.java 2012-03-27 11:28:36 UTC (rev 3210) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultForPoll.java 2012-03-27 11:28:43 UTC (rev 3211) @@ -151,6 +151,7 @@ @Override public String execute() throws Exception { + String pollId = getPollId(); Preconditions.checkNotNull(pollId); PollService service = newService(PollService.class); @@ -171,6 +172,7 @@ DateFormat.SHORT, DateFormat.SHORT, getLocale())); + String accountId = getAccountId(); if (poll.isPublicResults()) { userAllowed = true; } else if (StringUtils.isNotEmpty(accountId)) { Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java 2012-03-27 11:28:36 UTC (rev 3210) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java 2012-03-27 11:28:43 UTC (rev 3211) @@ -26,23 +26,22 @@ import com.opensymphony.xwork2.Preparable; import org.chorem.pollen.bean.PollUri; import org.chorem.pollen.business.persistence.Vote; -import org.chorem.pollen.business.persistence.VoteToChoice; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Votes to a poll. * * @author tchemit <chemit@codelutin.com> + * @author fdesbois <fdesbois@codelutin.com> * @since 1.2.6 */ public class VoteForPoll extends AbstractVoteAction implements Preparable { + + private static final Logger log = LoggerFactory.getLogger(VoteForPoll.class); private static final long serialVersionUID = 1L; - public void setVoteValueAsBoolean(int index, boolean value) { - VoteToChoice voteToChoice = getVote().getChoiceVoteToChoice().get(index); - voteToChoice.setVoteValue(value ? 1 : 0); - } - @Override public String input() throws Exception { @@ -52,6 +51,11 @@ @Override public String execute() throws Exception { + + // VALIDATION :: + // - votingId/name not empty + // - account not exists (matching userAccount) > check on all votes (EXISTS userAccount FROM poll.votes) + // - votingId/name is unique > check on all votes (EXISTS votingId FROM poll.votes) if (getVote().getTopiaId() != null) { getVoteService().updateVote(getVote()); @@ -69,6 +73,9 @@ PollUri pollUri = PollUri.newPollUri(pollId, accountId); String updateUrl = getVoteService().getUpdateVoteUrl(pollUri); + + log.debug("UpdateURL for poll '{}' and account '{}' = {}", new Object[]{pollId, accountId, updateUrl}); + addActionMessage(_("pollen.information.vote.createdWithUpdateUrl", updateUrl)); } else{ Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-poll.xml =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-poll.xml 2012-03-27 11:28:36 UTC (rev 3210) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-poll.xml 2012-03-27 11:28:43 UTC (rev 3211) @@ -225,9 +225,9 @@ <result type="redirectToVote"/> </action> - <!-- modify poll vote --> - <action name="modifyVote" - class="org.chorem.pollen.ui.actions.poll.ModifyVote"> + <!-- edit poll vote --> + <action name="editVote" + class="org.chorem.pollen.ui.actions.poll.EditVote"> <result type="redirectToVote"/> </action> Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp 2012-03-27 11:28:36 UTC (rev 3210) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp 2012-03-27 11:28:43 UTC (rev 3211) @@ -312,8 +312,8 @@ <s:if test="!poll.anonymous"> <s:if test="isModifAllowed(#vote.topiaId)"> <s:a action="editVote" namespace="/poll"> - <s:param name="uriId" value="%{uriId}"/> - <s:param name="voteId" value="%{#vote.topiaId}"/> + <s:param name="pollId" value="%{pollId}"/> + <s:param name="accountId" value="%{#vote.pollAccount.accountId}"/> <img src="<s:url value="/img/editSmall.png"/>" title="<s:text name="pollen.action.editVote"/>" alt="<s:text name="pollen.action.editVote"/>"/>