Pollen-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
March 2012
- 3 participants
- 68 discussions
r3191 - in branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main: java/org/chorem/pollen/ui/actions/json webapp/WEB-INF/jsp/admin
by tchemit@users.chorem.org 14 Mar '12
by tchemit@users.chorem.org 14 Mar '12
14 Mar '12
Author: tchemit
Date: 2012-03-14 18:22:21 +0100 (Wed, 14 Mar 2012)
New Revision: 3191
Url: http://chorem.org/repositories/revision/pollen/3191
Log:
fix delete poll from admin
Modified:
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetPolls.java
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/pollsList.jsp
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetPolls.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetPolls.java 2012-03-14 16:59:04 UTC (rev 3190)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetPolls.java 2012-03-14 17:22:21 UTC (rev 3191)
@@ -92,6 +92,7 @@
Poll.PROPERTY_END_DATE
);
map.put("id", poll.getTopiaId());
+ map.put("adminId", poll.getAdminId());
Set<String> functions = getPollFunctions(poll);
map.put("functions", functions);
polls[index++] = map;
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/pollsList.jsp
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/pollsList.jsp 2012-03-14 16:59:04 UTC (rev 3190)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/pollsList.jsp 2012-03-14 17:22:21 UTC (rev 3191)
@@ -24,7 +24,9 @@
<%@page contentType="text/html" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
-
+<script type="text/javascript">
+ var redirectUrl = '<s:url namespace="/admin" action="pollsList"/>';
+</script>
<%@include file="/WEB-INF/jsp/pollListHelper.jsp"%>
<title><s:text name="pollen.title.pollsList"/></title>
1
0
r3190 - in branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main: java/org/chorem/pollen/ui/actions/poll webapp/WEB-INF/jsp/poll
by tchemit@users.chorem.org 14 Mar '12
by tchemit@users.chorem.org 14 Mar '12
14 Mar '12
Author: tchemit
Date: 2012-03-14 17:59:04 +0100 (Wed, 14 Mar 2012)
New Revision: 3190
Url: http://chorem.org/repositories/revision/pollen/3190
Log:
generate and propage accountId at poll creation
Modified:
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/CreatePoll.java
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayPersonToList.java
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ImportPersonListToVotingList.java
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/personToList.jsp
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/CreatePoll.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/CreatePoll.java 2012-03-14 16:58:23 UTC (rev 3189)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/CreatePoll.java 2012-03-14 16:59:04 UTC (rev 3190)
@@ -997,6 +997,9 @@
String email = getNonEmptyParameterValue(prefix + ".email");
account.setEmail(email);
+ String accountId = getNonEmptyParameterValue(prefix + ".accountId");
+ account.setAccountId(accountId);
+
result.put(personToListNumber, personToList);
}
return personToListNumber;
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayPersonToList.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayPersonToList.java 2012-03-14 16:58:23 UTC (rev 3189)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayPersonToList.java 2012-03-14 16:59:04 UTC (rev 3190)
@@ -30,6 +30,7 @@
import org.chorem.pollen.business.persistence.PersonToList;
import org.chorem.pollen.business.persistence.PersonToListImpl;
import org.chorem.pollen.business.persistence.PollAccountImpl;
+import org.chorem.pollen.services.impl.PollService;
import org.chorem.pollen.ui.actions.PollenActionSupport;
import java.util.Map;
@@ -131,10 +132,7 @@
}
if (personToList == null) {
- personToList = new PersonToListImpl();
- personToList.setWeight(1);
- PollAccountImpl pollAccount = new PollAccountImpl();
- personToList.setPollAccount(pollAccount);
+ personToList = newService(PollService.class).getNewPersonToList(null);
}
// consume personToList errors
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ImportPersonListToVotingList.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ImportPersonListToVotingList.java 2012-03-14 16:58:23 UTC (rev 3189)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ImportPersonListToVotingList.java 2012-03-14 16:59:04 UTC (rev 3190)
@@ -26,9 +26,9 @@
import com.google.common.collect.Maps;
import org.chorem.pollen.business.persistence.PersonList;
import org.chorem.pollen.business.persistence.PersonToList;
-import org.chorem.pollen.business.persistence.PersonToListImpl;
import org.chorem.pollen.business.persistence.PollAccount;
import org.chorem.pollen.services.impl.FavoriteService;
+import org.chorem.pollen.services.impl.PollService;
import org.chorem.pollen.ui.PollenSession;
import org.chorem.pollen.ui.actions.PollenActionSupport;
@@ -100,11 +100,13 @@
service.getFavoriteList(session.getUserAccount(), personListId);
nbPersonToLists = favoriteList.sizePollAccount();
if (nbPersonToLists > 0) {
+
+ PollService pollService = newService(PollService.class);
+
int index = personToListNumber;
for (PollAccount pollAccount : favoriteList.getPollAccount()) {
- PersonToList p = new PersonToListImpl();
- p.setPollAccount(pollAccount);
- p.setWeight(1);
+
+ PersonToList p = pollService.getNewPersonToList(pollAccount);
data.put(index++, p);
}
}
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/personToList.jsp
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/personToList.jsp 2012-03-14 16:58:23 UTC (rev 3189)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/personToList.jsp 2012-03-14 16:59:04 UTC (rev 3190)
@@ -33,6 +33,7 @@
<s:div id='%{#prefix}'>
<s:fielderror/>
<s:hidden key='%{#prefix}.topiaId' value='%{personToList.topiaId}' label=''/>
+ <s:hidden key='%{#prefix}.accountId' value='%{personToList.pollAccount.accountId}' label=''/>
<div class="fleft choiceName">
<s:label for="%{#prefix}.votingId" id="%{#prefix}_label" theme="simple"
value=''/>
1
0
r3189 - branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl
by tchemit@users.chorem.org 14 Mar '12
by tchemit@users.chorem.org 14 Mar '12
14 Mar '12
Author: tchemit
Date: 2012-03-14 17:58:23 +0100 (Wed, 14 Mar 2012)
New Revision: 3189
Url: http://chorem.org/repositories/revision/pollen/3189
Log:
to create a PersonToList for a new poll
Modified:
branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java
Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java 2012-03-14 16:15:21 UTC (rev 3188)
+++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java 2012-03-14 16:58:23 UTC (rev 3189)
@@ -541,6 +541,22 @@
createThumbnail(pollChoiceImage, pollChoiceImageThumb, 100);
}
+ public PersonToList getNewPersonToList(PollAccount pollAccount) {
+ PersonToList result = newInstance(getDAO(PersonToList.class));
+ result.setWeight(1);
+ PollAccount pollAccount2 = newInstance(getDAO(PollAccount.class));
+ String accountId = serviceContext.createPollenUrlId();
+ pollAccount2.setAccountId(accountId);
+ result.setPollAccount(pollAccount2);
+ if (pollAccount != null) {
+ pollAccount2.setComment(pollAccount.getComment());
+ pollAccount2.setEmail(pollAccount.getEmail());
+ pollAccount2.setUserAccount(pollAccount.getUserAccount());
+ pollAccount2.setVotingId(pollAccount.getVotingId());
+ }
+ return result;
+ }
+
/**
* Création d'une miniature.
*
1
0
r3188 - in branches/pollen-1.2.6-struts2: pollen-persistence/src/main/java/org/chorem/pollen/business/persistence pollen-persistence/src/main/xmi pollen-services/src/main/java/org/chorem/pollen/services/impl
by tchemit@users.chorem.org 14 Mar '12
by tchemit@users.chorem.org 14 Mar '12
14 Mar '12
Author: tchemit
Date: 2012-03-14 17:15:21 +0100 (Wed, 14 Mar 2012)
New Revision: 3188
Url: http://chorem.org/repositories/revision/pollen/3188
Log:
fix votingUrl
Modified:
branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PollImpl.java
branches/pollen-1.2.6-struts2/pollen-persistence/src/main/xmi/pollen.zargo
branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/EmailService.java
branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java
Modified: branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PollImpl.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PollImpl.java 2012-03-14 16:15:06 UTC (rev 3187)
+++ branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PollImpl.java 2012-03-14 16:15:21 UTC (rev 3188)
@@ -45,7 +45,12 @@
@Override
public String getAdminId() {
- String accountId = getCreator().getAccountId();
+ return getVoteId(getCreator());
+ }
+
+ @Override
+ public String getVoteId(PollAccount account) {
+ String accountId = account.getAccountId();
return getPollId() + ":" + accountId;
}
} //PollImpl
Modified: branches/pollen-1.2.6-struts2/pollen-persistence/src/main/xmi/pollen.zargo
===================================================================
(Binary files differ)
Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/EmailService.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/EmailService.java 2012-03-14 16:15:06 UTC (rev 3187)
+++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/EmailService.java 2012-03-14 16:15:21 UTC (rev 3188)
@@ -38,6 +38,7 @@
import org.chorem.pollen.business.persistence.PollAccount;
import org.chorem.pollen.business.persistence.UserAccount;
import org.chorem.pollen.business.persistence.VotingList;
+import org.chorem.pollen.common.PollType;
import org.chorem.pollen.services.PollenServiceSupport;
import org.nuiton.util.StringUtil;
@@ -114,11 +115,14 @@
// Mail au créateur
if (StringUtils.isNotEmpty(poll.getCreator().getEmail())) {
-
+ String voteURL2 = voteURL;
+ if (poll.getPollType() != PollType.FREE) {
+ voteURL2 += ":" + poll.getCreator().getAccountId();
+ }
String subject = l_(locale, "pollen.email.creatorEmail.subject",
pollTitle);
String content = l_(locale, "pollen.email.creatorEmail.content",
- pollTitle, voteURL, modifURL);
+ pollTitle, voteURL2, modifURL);
PollEmail pollEmail = createPollEmail(
poll.getCreator().getEmail(), subject, content);
@@ -136,12 +140,13 @@
List<PollEmail> emails = Lists.newArrayList();
for (PollAccount account : votingPollAccounts) {
+ String accountId = account.getAccountId();
String accountVoteURL =
- voteURL + ":" + account.getAccountId();
+ voteURL + ":" + accountId;
String content =
l_(locale, "pollen.email.votingEmail.content",
- pollTitle, voteURL, accountVoteURL);
+ pollTitle, accountId, accountVoteURL);
PollEmail pollEmail = createPollEmail(
account.getEmail(), subject, content);
Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java 2012-03-14 16:15:06 UTC (rev 3187)
+++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java 2012-03-14 16:15:21 UTC (rev 3188)
@@ -47,7 +47,6 @@
import org.chorem.pollen.business.persistence.VotingList;
import org.chorem.pollen.business.persistence.VotingListDAO;
import org.chorem.pollen.common.ChoiceType;
-import org.chorem.pollen.common.PollType;
import org.chorem.pollen.services.PollenServiceSupport;
import org.chorem.pollen.services.exceptions.PollAccountNotFound;
import org.chorem.pollen.services.exceptions.PollChoiceNotFoundException;
@@ -251,11 +250,11 @@
// email notification
EmailService emailService = newService(EmailService.class);
- emailService.onPollCreated(poll, pollVoteUrl, pollEditUrl);
+ emailService.onPollCreated(result, pollVoteUrl, pollEditUrl);
// feed notification
PollFeedService pollFeedService = newService(PollFeedService.class);
- pollFeedService.onPollCreated(poll, pollVoteUrl);
+ pollFeedService.onPollCreated(result, pollVoteUrl);
return result;
}
@@ -263,21 +262,14 @@
public String getPollVoteUrl(Poll poll) {
URL applicationUrl = serviceContext.getApplicationURL();
StringBuilder url = new StringBuilder(applicationUrl.toString());
-
url.append("/poll/votefor/").append(poll.getPollId());
-
- if (poll.getPollType() != PollType.FREE) {
- url.append(':').append(poll.getCreator().getAccountId());
- }
return url.toString();
}
public String getPollEditUrl(Poll poll) {
URL applicationUrl = serviceContext.getApplicationURL();
StringBuilder url = new StringBuilder(applicationUrl.toString());
-
- url.append("/poll/modification/").append(poll.getPollId());
- url.append(':').append(poll.getCreator().getAccountId());
+ url.append("/poll/modification/").append(poll.getAdminId());
return url.toString();
}
1
0
r3187 - branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config
by tchemit@users.chorem.org 14 Mar '12
by tchemit@users.chorem.org 14 Mar '12
14 Mar '12
Author: tchemit
Date: 2012-03-14 17:15:06 +0100 (Wed, 14 Mar 2012)
New Revision: 3187
Url: http://chorem.org/repositories/revision/pollen/3187
Log:
fix urls
Modified:
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-poll.xml
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-14 16:14:45 UTC (rev 3186)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-poll.xml 2012-03-14 16:15:06 UTC (rev 3187)
@@ -165,8 +165,7 @@
<action name="participatedList"
class="org.chorem.pollen.ui.actions.poll.ParticipatedList">
<interceptor-ref name="pollenBasicLogguedStack"/>
- <result name="input">/WEB-INF/jsp/poll/participatedList.jsp</result>
- <result>/WEB-INF/jsp/home.jsp</result>
+ <result>/WEB-INF/jsp/poll/participatedList.jsp</result>
</action>
<!-- confirm delete comment -->
1
0
r3186 - in branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF: decorators jsp/poll
by tchemit@users.chorem.org 14 Mar '12
by tchemit@users.chorem.org 14 Mar '12
14 Mar '12
Author: tchemit
Date: 2012-03-14 17:14:45 +0100 (Wed, 14 Mar 2012)
New Revision: 3186
Url: http://chorem.org/repositories/revision/pollen/3186
Log:
fix urls
Modified:
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createdList.jsp
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/participatedList.jsp
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp 2012-03-14 14:43:26 UTC (rev 3185)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp 2012-03-14 16:14:45 UTC (rev 3186)
@@ -172,12 +172,12 @@
</li>
<s:if test="userExists">
<li>
- <s:a action="createdList" method="input" namespace="/poll">
+ <s:a action="createdList" namespace="/poll">
<s:text name="pollen.menu.pollsCreatedList"/>
</s:a>
</li>
<li>
- <s:a action="participatedList" method="input" namespace="/poll">
+ <s:a action="participatedList" namespace="/poll">
<s:text name="pollen.menu.pollsParticipatedList"/>
</s:a>
</li>
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createdList.jsp
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createdList.jsp 2012-03-14 14:43:26 UTC (rev 3185)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createdList.jsp 2012-03-14 16:14:45 UTC (rev 3186)
@@ -26,7 +26,7 @@
<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
<script type="text/javascript">
-var redirectUrl = '<s:url namespace="/poll" action="createdList" method="input"/>';
+var redirectUrl = '<s:url namespace="/poll" action="createdList"/>';
</script>
<%@include file="/WEB-INF/jsp/pollListHelper.jsp"%>
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/participatedList.jsp
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/participatedList.jsp 2012-03-14 14:43:26 UTC (rev 3185)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/participatedList.jsp 2012-03-14 16:14:45 UTC (rev 3186)
@@ -25,8 +25,7 @@
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
<script type="text/javascript">
- var redirectUrl =
- '<s:url namespace="/poll" action="participatedList" method="input"/>';
+ var redirectUrl = '<s:url namespace="/poll" action="participatedList"/>';
</script>
<%@include file="/WEB-INF/jsp/pollListHelper.jsp"%>
1
0
r3185 - in branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main: java/org/chorem/pollen/ui java/org/chorem/pollen/ui/actions/json java/org/chorem/pollen/ui/actions/poll resources/config resources/i18n webapp/WEB-INF/jsp webapp/WEB-INF/jsp/poll
by tchemit@users.chorem.org 14 Mar '12
by tchemit@users.chorem.org 14 Mar '12
14 Mar '12
Author: tchemit
Date: 2012-03-14 15:43:26 +0100 (Wed, 14 Mar 2012)
New Revision: 3185
Url: http://chorem.org/repositories/revision/pollen/3185
Log:
- add delete poll action
- add adminId for poll in json actions
- remove some javascript logs
- change session log levels
Added:
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeletePoll.java
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePoll.jsp
Modified:
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenSession.java
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/AbstractJSONPaginedAction.java
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetCreatedPolls.java
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetInvitedPolls.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/resources/config/struts-poll.xml
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createdList.jsp
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/participatedList.jsp
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/selectPersonListToAddToVotingList.jsp
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollListHelper.jsp
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenSession.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenSession.java 2012-03-14 14:41:51 UTC (rev 3184)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenSession.java 2012-03-14 14:43:26 UTC (rev 3185)
@@ -62,21 +62,24 @@
public void putDynamicData(String token, Object data) {
getDynamicData().put(token, data);
- if (log.isInfoEnabled()) {
- log.info("Dynamic attributes size : " + getDynamicData().size());
+ if (log.isDebugEnabled()) {
+ log.debug("Dynamic attributes size : " + getDynamicData().size());
}
}
public void removeDynamicData(String token) {
getDynamicData().remove(token);
- if (log.isInfoEnabled()) {
- log.info("Dynamic attributes size : " + getDynamicData().size());
+ if (log.isDebugEnabled()) {
+ log.debug("Dynamic attributes size : " + getDynamicData().size());
}
}
public void clearDynamicData() {
if (dynamicData != null) {
dynamicData.clear();
+ if (log.isDebugEnabled()) {
+ log.debug("Dynamic attributes size : " + dynamicData.size());
+ }
}
}
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/AbstractJSONPaginedAction.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/AbstractJSONPaginedAction.java 2012-03-14 14:41:51 UTC (rev 3184)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/AbstractJSONPaginedAction.java 2012-03-14 14:43:26 UTC (rev 3185)
@@ -27,6 +27,7 @@
import org.apache.struts2.json.JSONException;
import org.apache.struts2.json.JSONUtil;
import org.chorem.pollen.ui.actions.PollenActionSupport;
+import org.nuiton.topia.persistence.TopiaFilterPagerUtil;
import org.nuiton.web.struts2.FilterPagerUtil;
/**
@@ -47,8 +48,8 @@
public abstract Integer getRecords();
- protected FilterPagerUtil.FilterPagerBean pager =
- FilterPagerUtil.newFilterPagerBean();
+ protected TopiaFilterPagerUtil.FilterPagerBean pager =
+ TopiaFilterPagerUtil.newFilterPagerBean();
protected String filters;
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetCreatedPolls.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetCreatedPolls.java 2012-03-14 14:41:51 UTC (rev 3184)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetCreatedPolls.java 2012-03-14 14:43:26 UTC (rev 3185)
@@ -92,6 +92,7 @@
Poll.PROPERTY_END_DATE
);
map.put("id", poll.getTopiaId());
+ map.put("adminId", poll.getAdminId());
Set<String> functions = getPollFunctions(poll);
map.put("functions", functions);
polls[index++] = map;
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetInvitedPolls.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetInvitedPolls.java 2012-03-14 14:41:51 UTC (rev 3184)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetInvitedPolls.java 2012-03-14 14:43:26 UTC (rev 3185)
@@ -95,6 +95,7 @@
Poll.PROPERTY_END_DATE
);
String userEmail = getPollenSession().getUserAccount().getEmail();
+ map.put("adminId", poll.getAdminId());
map.put("voteId", getVoteId(poll, userEmail));
map.put("id", poll.getTopiaId());
Set<String> functions = getPollFunctions(poll);
Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeletePoll.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeletePoll.java (rev 0)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeletePoll.java 2012-03-14 14:43:26 UTC (rev 3185)
@@ -0,0 +1,62 @@
+/*
+ * #%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;
+
+import com.google.common.base.Preconditions;
+import org.chorem.pollen.business.persistence.Poll;
+import org.chorem.pollen.services.impl.PollService;
+
+/**
+ * Confirm to delete a poll.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.2.6
+ */
+public class ConfirmDeletePoll extends AbstractPollUriIdAction {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Poll poll;
+
+ protected String redirectUrl;
+
+ public String getRedirectUrl() {
+ return redirectUrl;
+ }
+
+ public void setRedirectUrl(String redirectUrl) {
+ this.redirectUrl = redirectUrl;
+ }
+
+ public Poll getPoll() {
+ return poll;
+ }
+
+ @Override
+ public String execute() throws Exception {
+ Preconditions.checkNotNull(pollId);
+ poll = newService(PollService.class).getPollByPollId(pollId);
+ return SUCCESS;
+ }
+}
Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeletePoll.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
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-14 14:41:51 UTC (rev 3184)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeletePoll.java 2012-03-14 14:43:26 UTC (rev 3185)
@@ -23,7 +23,7 @@
*/
package org.chorem.pollen.ui.actions.poll;
-import org.chorem.pollen.ui.actions.PollenActionSupport;
+import org.chorem.pollen.services.impl.PollService;
/**
* Deletes an existing poll.
@@ -34,4 +34,26 @@
public class DeletePoll extends AbstractPollUriIdAction {
private static final long serialVersionUID = 1L;
+
+ protected String redirectUrl;
+
+ public String getRedirectUrl() {
+ return redirectUrl;
+ }
+
+ public void setRedirectUrl(String redirectUrl) {
+ this.redirectUrl = redirectUrl;
+ }
+
+ @Override
+ public String execute() throws Exception {
+
+ PollService service = newService(PollService.class);
+
+ service.deletePoll(pollId, getPollenSession().getUserAccount(), accountId);
+
+// String fullUrl = getApplicationUrl() + redirectUrl;
+// setRedirectUrl(fullUrl);
+ return SUCCESS;
+ }
}
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-14 14:41:51 UTC (rev 3184)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-poll.xml 2012-03-14 14:43:26 UTC (rev 3185)
@@ -130,12 +130,21 @@
<result>/WEB-INF/jsp/home.jsp</result>
</action>
+ <!-- confirm delete poll -->
+ <action name="confirmDeletePoll/*"
+ class="org.chorem.pollen.ui.actions.poll.ConfirmDeletePoll">
+ <param name="uriId">{1}</param>
+ <result>/WEB-INF/jsp/poll/confirmDeletePoll.jsp</result>
+ </action>
+
<!-- delete poll -->
<action name="delete/*"
class="org.chorem.pollen.ui.actions.poll.DeletePoll">
<param name="uriId">{1}</param>
- <result name="input">/WEB-INF/jsp/poll/delete.jsp</result>
- <result>/WEB-INF/jsp/home.jsp</result>
+ <result type="redirect">
+ <param name="location">${redirectUrl}</param>
+ <param name="prependServletContext">false</param>
+ </result>
</action>
<!-- display poll result -->
@@ -149,8 +158,7 @@
<action name="createdList"
class="org.chorem.pollen.ui.actions.poll.CreatedList">
<interceptor-ref name="pollenBasicLogguedStack"/>
- <result name="input">/WEB-INF/jsp/poll/createdList.jsp</result>
- <result>/WEB-INF/jsp/home.jsp</result>
+ <result>/WEB-INF/jsp/poll/createdList.jsp</result>
</action>
<!-- display participated polls -->
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-03-14 14:41:51 UTC (rev 3184)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-03-14 14:43:26 UTC (rev 3185)
@@ -173,9 +173,11 @@
pollen.info.poll.created=Poll created
pollen.info.poll.updated=Poll modified
pollen.information.confirmDeleteChoice=Confirm delete of choice %s
+pollen.information.confirmDeletePoll=Confirm delete of poll\:
pollen.information.confirmDeleteVote=Confirm delete of vote for %s
pollen.information.favoriteList.created=Favorite list %s created.
pollen.information.favoriteList.deleted=Favorite list %s deleted.
+pollen.information.irreversible.operation=Be ware, this operation is irreversible.
pollen.information.need.login=You must be logged to access this page. Please fill the form below.
pollen.information.pollAccount.addedTofavoriteList=Member '%s was added to favorite list.
pollen.information.pollAccount.removedFromFavoriteList=Member %s was removed from favorite list.
@@ -209,11 +211,12 @@
pollen.menu.register=Register
pollen.menu.userFavoriteLists=Voting lists
pollen.title.createPoll=New poll
-pollen.title.delete.pollChoice=Confirm to delete a poll choice
-pollen.title.delete.pollComment=Confirm to delete a poll comment
-pollen.title.delete.pollVote=Confirm to delete a poll vote
-pollen.title.editFavoriteList=Edition de la liste des favoris
-pollen.title.favoriteLists=Vos listes de votants
+pollen.title.delete.poll=Delete a poll
+pollen.title.delete.pollChoice=Delete a poll choice
+pollen.title.delete.pollComment=Delete a poll comment
+pollen.title.delete.pollVote=Delete a poll vote
+pollen.title.editFavoriteList=Edit a favorite list
+pollen.title.favoriteLists=Your favorite lists
pollen.title.myAccount=My account
pollen.title.pollsCreatedList=Polls created
pollen.title.pollsCreatedList.legend=Polls you have proposed
@@ -222,6 +225,6 @@
pollen.title.pollsParticipatedList=Polls participated
pollen.title.pollsParticipatedList.legend=Polls in which you are involved
pollen.title.register=Register
-pollen.title.selectPersonListToAddVotingList=Sélectionner une liste de votant à ajouter
-pollen.title.selectPersonListToCreateVotingList=Sélectionner une liste de votant pour créer un nouveau groupe
+pollen.title.selectPersonListToAddVotingList=Select a voter list to import in voting list
+pollen.title.selectPersonListToCreateVotingList=Select a favorite list to import in a new voting list
pollen.title.usersList=Users administration
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-03-14 14:41:51 UTC (rev 3184)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-03-14 14:43:26 UTC (rev 3185)
@@ -179,10 +179,12 @@
pollen.fieldset.userInformation.toUpdate=Informations de l'utilisateur à mettre à jour
pollen.info.poll.created=Sondage créé
pollen.info.poll.updated=Sondage mise à jour
-pollen.information.confirmDeletePollChoice=Confirmer la suppression du chois %s
+pollen.information.confirmDeletePoll=Confirmer la suppression du sondage \:
+pollen.information.confirmDeletePollChoice=Confirmer la suppression du choix %s
pollen.information.confirmDeletePollVote=Confirmer la suppression du vote de %s
pollen.information.favoriteList.created=La liste %s a été créée.
pollen.information.favoriteList.deleted=La liste %s a été supprimée.
+pollen.information.irreversible.operation=Attention, Cette opération est irréversible.
pollen.information.need.login=Vous devez être identifié pour pouvoir accéder à cette page. Veuillez remplir le formulaire ci-dessous.
pollen.information.pollAccount.addedTofavoriteList=Le membre %s a été ajoutée à la liste des favoris.
pollen.information.pollAccount.removedFromFavoriteList=Le membre %s a été supprimé de la liste des favoris.
@@ -218,9 +220,10 @@
pollen.tab.poll.general=Informations
pollen.tab.poll.options=Options
pollen.title.createPoll=Nouveau sondage
-pollen.title.delete.pollChoice=Confirmer la suppresion d'un choix
-pollen.title.delete.pollComment=Confirmer la suppresion d'un commentaire
-pollen.title.delete.pollVote=Confirmer la suppresion d'un vote
+pollen.title.delete.poll=Suppression d'un sondage
+pollen.title.delete.pollChoice=Suppression d'un choix
+pollen.title.delete.pollComment=Suppression d'un commentaire
+pollen.title.delete.pollVote=Suppression d'un vote
pollen.title.editFavoriteList=Edition de la liste des favoris
pollen.title.favoriteLists=Vos listes de votants
pollen.title.myAccount=Mon compte
Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePoll.jsp
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePoll.jsp (rev 0)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePoll.jsp 2012-03-14 14:43:26 UTC (rev 3185)
@@ -0,0 +1,56 @@
+<%--
+ #%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%
+ --%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<script type="text/javascript">
+ function cancel() {
+ $('#confirmDeletePollDialog').dialog('close');
+ return false;
+ }
+</script>
+<s:form method="POST" namespace="/poll">
+ <fieldset class="ui-widget-content ui-corner-all">
+
+ <s:hidden key="redirectUrl" label=''/>
+ <s:hidden key="uriId" label=''/>
+
+ <s:text name="pollen.information.confirmDeletePoll"/>
+ <div align="center" style="padding-top: 1em;">
+ "<strong><s:property value="poll.title"/></strong>"
+ </div>
+ <br/>
+
+ <div style="padding-top: 1em;">
+ <strong><s:text
+ name="pollen.information.irreversible.operation"/></strong>
+ </div>
+ <hr/>
+ <div align="right">
+ <s:submit onclick="return cancel();" theme="simple"
+ key="pollen.action.cancel"/>
+ <s:submit key="pollen.action.delete" theme="simple"
+ action="delete/%{pollId}"/>
+ </div>
+ </fieldset>
+</s:form>
\ No newline at end of file
Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePoll.jsp
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp 2012-03-14 14:41:51 UTC (rev 3184)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp 2012-03-14 14:43:26 UTC (rev 3185)
@@ -40,7 +40,6 @@
}
function selectPersonListToAddToVotingList(votingListNumber) {
- console.info("Add to votingList "+votingListNumber);
$('.ui-dialog-title').html('<s:text name="pollen.title.selectPersonListToAddVotingList"/>')
var dialog = $("#selectPersonListDialog");
var url = "<s:url action='selectPersonListToAddToVotingList' namespace='/poll'/>";
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createdList.jsp
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createdList.jsp 2012-03-14 14:41:51 UTC (rev 3184)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createdList.jsp 2012-03-14 14:43:26 UTC (rev 3185)
@@ -25,6 +25,9 @@
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
+<script type="text/javascript">
+var redirectUrl = '<s:url namespace="/poll" action="createdList" method="input"/>';
+</script>
<%@include file="/WEB-INF/jsp/pollListHelper.jsp"%>
<title><s:text name="pollen.title.pollsCreatedList"/></title>
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/participatedList.jsp
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/participatedList.jsp 2012-03-14 14:41:51 UTC (rev 3184)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/participatedList.jsp 2012-03-14 14:43:26 UTC (rev 3185)
@@ -24,7 +24,10 @@
<%@page contentType="text/html" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
-
+<script type="text/javascript">
+ var redirectUrl =
+ '<s:url namespace="/poll" action="participatedList" method="input"/>';
+</script>
<%@include file="/WEB-INF/jsp/pollListHelper.jsp"%>
<title><s:text name="pollen.title.pollsParticipatedList"/></title>
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/selectPersonListToAddToVotingList.jsp
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/selectPersonListToAddToVotingList.jsp 2012-03-14 14:41:51 UTC (rev 3184)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/selectPersonListToAddToVotingList.jsp 2012-03-14 14:43:26 UTC (rev 3185)
@@ -24,7 +24,6 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
-
<script type="text/javascript">
var votingListNumber = parseInt('<s:property value='%{votingListNumber}'/>');
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollListHelper.jsp
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollListHelper.jsp 2012-03-14 14:41:51 UTC (rev 3184)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollListHelper.jsp 2012-03-14 14:43:26 UTC (rev 3185)
@@ -23,6 +23,7 @@
--%>
<%@page contentType="text/html" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
+<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>
<script type="text/javascript"
src="<s:url value='/js/gridHelper.js' />"></script>
@@ -53,16 +54,27 @@
<s:url id='cloneImg' value='/img/copy.png'/>
<s:set id='cloneTitle'><s:text name="pollen.action.pollClone"/></s:set>
-<s:url id="deleteUrl" action="delete/" namespace="/poll" method="input"/>
+<s:url id="deleteUrl" action="confirmDeletePoll/" namespace="/poll"/>
<s:url id='deleteImg' value='/img/delete.png'/>
<s:set id='deleteTitle'><s:text name="pollen.action.pollDelete"/></s:set>
<script type="text/javascript">
+ function confirmDelete(id) {
+ var dialog = $("#confirmDeletePollDialog");
+ var url = "<s:url action='confirmDeletePoll/' namespace='/poll'/>";
+ url += id + '?' + $.param({redirectUrl:redirectUrl});
+ dialog.load(url);
+ dialog.dialog('open');
+ return false;
+ }
+
function pollFunctions(cellvalue, options, rowObject) {
var id = rowObject.pollId;
+ var adminId = rowObject.adminId;
+ console.info("adminId = "+adminId);
var result = "";
if (rowObject['voteId']) {
@@ -76,23 +88,32 @@
result += formatLink("${resultUrl}" + id, "${resultImg}", "Result", "${resultTitle}")
}
if (cellvalue.indexOf('edit') > -1) {
- result += formatLink("${editUrl}" + id, "${editImg}", "Edit", "${editTitle}")
+ result += formatLink("${editUrl}" + adminId, "${editImg}", "Edit", "${editTitle}")
}
if (cellvalue.indexOf('close') > -1) {
- result += formatLink("${closeUrl}" + id, "${closeImg}", "Close", "${closeTitle}")
+ result += formatLink("${closeUrl}" + adminId, "${closeImg}", "Close", "${closeTitle}")
}
if (cellvalue.indexOf('export') > -1) {
result += formatLink("${exportUrl}" + id, "${exportImg}", "Export", "${exportTitle}")
}
if (cellvalue.indexOf('clone') > -1) {
- result += formatLink("${cloneUrl}" + id, "${cloneImg}", "Clone", "${cloneTitle}")
+ result += formatLink("${cloneUrl}" + adminId, "${cloneImg}", "Clone", "${cloneTitle}")
}
if (cellvalue.indexOf('delete') > -1) {
- result += formatLink("${deleteUrl}" + id, "${deleteImg}", "Delete", "${deleteTitle}")
+ var script = 'return confirmDelete("' + adminId + '");'
+ result += formatLinkByScript(script, "${deleteImg}", "Delete", "${deleteTitle}")
}
return result;
}
function formatLink(url, image, imageAlt, imageTitle) {
return "<a href='" + url + "'><image alt='" + imageAlt + "' title='" + imageTitle + "' src='" + image + "'> </a>";
}
+ function formatLinkByScript(script, image, imageAlt, imageTitle) {
+ return "<a href='#' onclick='" + script + "'><image alt='" + imageAlt + "' title='" + imageTitle + "' src='" + image + "'> </a>";
+ }
</script>
+
+<sj:dialog id="confirmDeletePollDialog" resizable="true" autoOpen="false"
+ title="%{getText('pollen.title.delete.poll')}"
+ modal="true" width="500"/>
+
1
0
r3184 - in branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources: . org/chorem/pollen/ui/actions/admin org/chorem/pollen/ui/actions/poll org/chorem/pollen/ui/actions/user
by tchemit@users.chorem.org 14 Mar '12
by tchemit@users.chorem.org 14 Mar '12
14 Mar '12
Author: tchemit
Date: 2012-03-14 15:41:51 +0100 (Wed, 14 Mar 2012)
New Revision: 3184
Url: http://chorem.org/repositories/revision/pollen/3184
Log:
use cached dtd for validators
Modified:
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-create-validation.xml
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-edit-validation.xml
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/poll/AddComment-addComment-validation.xml
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/user/Edit-validation.xml
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/user/Login-validation.xml
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/user/ManageFavoriteList-addPollAccount-validation.xml
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/user/ManageFavoriteList-editPollAccount-validation.xml
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/user/ManageFavoriteLists-createFavoriteList-validation.xml
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/user/Register-validation.xml
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/validators.xml
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-create-validation.xml
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-create-validation.xml 2012-03-14 14:41:15 UTC (rev 3183)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-create-validation.xml 2012-03-14 14:41:51 UTC (rev 3184)
@@ -21,9 +21,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
-->
-<!DOCTYPE validators PUBLIC
- "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
- "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.3.dtd">
<validators>
<field name="createUser.login">
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-edit-validation.xml
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-edit-validation.xml 2012-03-14 14:41:15 UTC (rev 3183)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/admin/ManageUsers-edit-validation.xml 2012-03-14 14:41:51 UTC (rev 3184)
@@ -21,9 +21,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
-->
-<!DOCTYPE validators PUBLIC
- "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
- "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.3.dtd">
<validators>
<field name="editUser.login">
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/poll/AddComment-addComment-validation.xml
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/poll/AddComment-addComment-validation.xml 2012-03-14 14:41:15 UTC (rev 3183)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/poll/AddComment-addComment-validation.xml 2012-03-14 14:41:51 UTC (rev 3184)
@@ -24,9 +24,8 @@
-->
-<!DOCTYPE validators PUBLIC
- "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
- "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.3.dtd">
<validators>
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/user/Edit-validation.xml
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/user/Edit-validation.xml 2012-03-14 14:41:15 UTC (rev 3183)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/user/Edit-validation.xml 2012-03-14 14:41:51 UTC (rev 3184)
@@ -21,9 +21,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
-->
-<!DOCTYPE validators PUBLIC
- "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
- "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.3.dtd">
<validators>
<field name="user.login">
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/user/Login-validation.xml
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/user/Login-validation.xml 2012-03-14 14:41:15 UTC (rev 3183)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/user/Login-validation.xml 2012-03-14 14:41:51 UTC (rev 3184)
@@ -21,9 +21,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
-->
-<!DOCTYPE validators PUBLIC
- "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
- "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.3.dtd">
<validators>
<field name="login">
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/user/ManageFavoriteList-addPollAccount-validation.xml
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/user/ManageFavoriteList-addPollAccount-validation.xml 2012-03-14 14:41:15 UTC (rev 3183)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/user/ManageFavoriteList-addPollAccount-validation.xml 2012-03-14 14:41:51 UTC (rev 3184)
@@ -24,9 +24,8 @@
-->
-<!DOCTYPE validators PUBLIC
- "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
- "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.3.dtd">
<validators>
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/user/ManageFavoriteList-editPollAccount-validation.xml
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/user/ManageFavoriteList-editPollAccount-validation.xml 2012-03-14 14:41:15 UTC (rev 3183)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/user/ManageFavoriteList-editPollAccount-validation.xml 2012-03-14 14:41:51 UTC (rev 3184)
@@ -24,9 +24,8 @@
-->
-<!DOCTYPE validators PUBLIC
- "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
- "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.3.dtd">
<validators>
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/user/ManageFavoriteLists-createFavoriteList-validation.xml
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/user/ManageFavoriteLists-createFavoriteList-validation.xml 2012-03-14 14:41:15 UTC (rev 3183)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/user/ManageFavoriteLists-createFavoriteList-validation.xml 2012-03-14 14:41:51 UTC (rev 3184)
@@ -21,9 +21,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
-->
-<!DOCTYPE validators PUBLIC
- "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
- "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.3.dtd">
<validators>
<field name="createFavoriteList.name">
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/user/Register-validation.xml
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/user/Register-validation.xml 2012-03-14 14:41:15 UTC (rev 3183)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/user/Register-validation.xml 2012-03-14 14:41:51 UTC (rev 3184)
@@ -21,9 +21,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
-->
-<!DOCTYPE validators PUBLIC
- "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
- "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.3.dtd">
<validators>
<field name="user.login">
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/validators.xml
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/validators.xml 2012-03-14 14:41:15 UTC (rev 3183)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/validators.xml 2012-03-14 14:41:51 UTC (rev 3184)
@@ -23,8 +23,7 @@
#L%
-->
-<!DOCTYPE validators PUBLIC
- "-//OpenSymphony Group//XWork Validator Config 1.0//EN"
+<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator Config 1.0//EN"
"http://www.opensymphony.com/xwork/xwork-validator-config-1.0.dtd">
<validators>
<!-- default validators from XWork framework -->
1
0
Author: tchemit
Date: 2012-03-14 15:41:15 +0100 (Wed, 14 Mar 2012)
New Revision: 3183
Url: http://chorem.org/repositories/revision/pollen/3183
Log:
use snpshot of topia
Modified:
branches/pollen-1.2.6-struts2/pom.xml
Modified: branches/pollen-1.2.6-struts2/pom.xml
===================================================================
--- branches/pollen-1.2.6-struts2/pom.xml 2012-03-14 14:40:57 UTC (rev 3182)
+++ branches/pollen-1.2.6-struts2/pom.xml 2012-03-14 14:41:15 UTC (rev 3183)
@@ -435,7 +435,7 @@
<projectId>pollen</projectId>
<!-- customized versions -->
- <topiaVersion>2.6.7</topiaVersion>
+ <topiaVersion>2.6.9-SNAPSHOT</topiaVersion>
<eugenePluginVersion>2.4.2</eugenePluginVersion>
<nuitonI18nVersion>2.4.1</nuitonI18nVersion>
<tapestryVersion>5.1.0.5</tapestryVersion>
1
0
r3182 - in branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services: exceptions impl
by tchemit@users.chorem.org 14 Mar '12
by tchemit@users.chorem.org 14 Mar '12
14 Mar '12
Author: tchemit
Date: 2012-03-14 15:40:57 +0100 (Wed, 14 Mar 2012)
New Revision: 3182
Url: http://chorem.org/repositories/revision/pollen/3182
Log:
- all queries are in persistence layer
- implements delete poll action
Added:
branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollAccountNotFound.java
branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UnauthorizedPollAccessException.java
Modified:
branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/FavoriteService.java
branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollCommentService.java
branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java
branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/UserService.java
branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/VoteService.java
Added: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollAccountNotFound.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollAccountNotFound.java (rev 0)
+++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollAccountNotFound.java 2012-03-14 14:40:57 UTC (rev 3182)
@@ -0,0 +1,34 @@
+/*
+ * #%L
+ * Pollen :: Services
+ *
+ * $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.services.exceptions;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.2.6
+ */
+public class PollAccountNotFound extends Exception {
+ private static final long serialVersionUID = 1L;
+}
Property changes on: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollAccountNotFound.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UnauthorizedPollAccessException.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UnauthorizedPollAccessException.java (rev 0)
+++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UnauthorizedPollAccessException.java 2012-03-14 14:40:57 UTC (rev 3182)
@@ -0,0 +1,34 @@
+/*
+ * #%L
+ * Pollen :: Services
+ *
+ * $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.services.exceptions;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.2.6
+ */
+public class UnauthorizedPollAccessException extends Exception {
+ private static final long serialVersionUID = 1L;
+}
Property changes on: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/UnauthorizedPollAccessException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/FavoriteService.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/FavoriteService.java 2012-03-14 14:40:02 UTC (rev 3181)
+++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/FavoriteService.java 2012-03-14 14:40:57 UTC (rev 3182)
@@ -43,8 +43,7 @@
import org.chorem.pollen.services.exceptions.ParticipantNotFoundInListException;
import org.chorem.pollen.services.exceptions.UserNotFoundException;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaQuery;
-import org.nuiton.web.struts2.FilterPagerUtil;
+import org.nuiton.topia.persistence.TopiaFilterPagerUtil;
import java.util.List;
@@ -54,23 +53,13 @@
private static final Log log = LogFactory.getLog(FavoriteService.class);
public List<PersonList> getFavoriteLists(UserAccount user,
- FilterPagerUtil.FilterPagerBean pager) {
+ TopiaFilterPagerUtil.FilterPagerBean pager) {
Preconditions.checkNotNull(user);
- PersonListDAO dao = getDAO(PersonList.class);
-
try {
-
- TopiaQuery countQuery = dao.createQuery("e");
- countQuery.addWhere("e." + PersonList.PROPERTY_OWNER, TopiaQuery.Op.EQ, user);
- long records = dao.countByQuery(countQuery);
-
- pager.setRecords((int) records);
-
- TopiaQuery query = FilterPagerUtil.addPagerToQuery(countQuery, pager);
-
- List<PersonList> result = dao.findAllByQuery(query);
+ PersonListDAO dao = getDAO(PersonList.class);
+ List<PersonList> result = dao.getFavoriteLists(user, pager);
return result;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
@@ -81,13 +70,9 @@
Preconditions.checkNotNull(user);
- PersonListDAO dao = getDAO(PersonList.class);
-
try {
-
- TopiaQuery query = dao.createQuery("e");
- query.addWhere("e." + PersonList.PROPERTY_OWNER, TopiaQuery.Op.EQ, user);
- List<PersonList> result = dao.findAllByQuery(query);
+ PersonListDAO dao = getDAO(PersonList.class);
+ List<PersonList> result = dao.getFavoriteLists(user);
return result;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
@@ -100,9 +85,8 @@
Preconditions.checkNotNull(user);
Preconditions.checkNotNull(favoriteListId);
- PersonListDAO dao = getDAO(PersonList.class);
-
try {
+ PersonListDAO dao = getDAO(PersonList.class);
PersonList favoriteList = dao.findByTopiaId(favoriteListId);
@@ -124,23 +108,15 @@
}
public List<PollAccount> getFavoriteListUsers(PersonList favoriteList,
- FilterPagerUtil.FilterPagerBean pager) {
+ TopiaFilterPagerUtil.FilterPagerBean pager) {
Preconditions.checkNotNull(favoriteList);
Preconditions.checkNotNull(pager);
- PollAccountDAO dao = getDAO(PollAccount.class);
-
try {
- int records = favoriteList.sizePollAccount();
- pager.setRecords(records);
-
- TopiaQuery query = dao.createQuery("e");
- FilterPagerUtil.addPagerToQuery(query, pager);
- query.addWhere("e." + PollAccount.PROPERTY_PERSON_LIST, TopiaQuery.Op.EQ, favoriteList);
-
- List<PollAccount> result = dao.findAllByQuery(query);
+ PollAccountDAO dao = getDAO(PollAccount.class);
+ List<PollAccount> result = dao.getFavoriteListUsers(favoriteList, pager);
return result;
} catch (TopiaException e) {
@@ -171,13 +147,8 @@
// check list does not already exists
- TopiaQuery query = dao.createQuery("e");
+ boolean exist = dao.isPersonListExist(user, name);
- query.addWhere("e." + PersonList.PROPERTY_OWNER, TopiaQuery.Op.EQ, user);
- query.addWhere("e." + PersonList.PROPERTY_NAME, TopiaQuery.Op.EQ, name);
-
- boolean exist = dao.existByQuery(query);
-
if (exist) {
throw new FavoriteListAlreadyExistException();
@@ -258,10 +229,7 @@
}
// check there is other poll account in this list with same id
- TopiaQuery query = dao.createQuery("e");
- query.addWhere("e." + PollAccount.PROPERTY_PERSON_LIST, TopiaQuery.Op.EQ, personListToUpdate);
- query.addWhere("e." + PollAccount.PROPERTY_VOTING_ID, TopiaQuery.Op.EQ, pollAccount.getVotingId());
- boolean pollAccountExists = dao.existByQuery(query);
+ boolean pollAccountExists = dao.isPollAccountExist(personListToUpdate, pollAccount);
if (pollAccountExists) {
throw new ParticipantAlreadyFoundInListException();
@@ -314,11 +282,7 @@
}
// check there is another poll account in this list with same id
- TopiaQuery query = dao.createQuery("e");
- query.addWhere("e." + PollAccount.PROPERTY_PERSON_LIST, TopiaQuery.Op.EQ, personListToUpdate);
- query.addWhere("e." + PollAccount.PROPERTY_VOTING_ID, TopiaQuery.Op.EQ, pollAccount.getVotingId());
- query.addWhere("e." + PollAccount.TOPIA_ID, TopiaQuery.Op.NEQ, pollAccount.getTopiaId());
- boolean pollAccountExists = dao.existByQuery(query);
+ boolean pollAccountExists = dao.isPollAccountAlreadyExist(personListToUpdate, pollAccount);
if (pollAccountExists) {
throw new ParticipantAlreadyFoundInListException();
@@ -384,208 +348,4 @@
PollAccount pollAccount = newInstance(dao);
return pollAccount;
}
-
-// public void createFavoriteParticipant(FavoriteParticipant participant) throws ParticipantExistWithoutMailException, ParticipantAlreadyFoundInListException {
-// try {
-// FavoriteParticipantDAO dao =
-// PollenDAOHelper.getFavoriteParticipantDAO(getTransaction());
-//
-// checkFavoriteParticipant(dao, participant);
-//
-// // Create newParticipant with naturalId
-// FavoriteParticipant result =
-// dao.create(participant.getName(),
-// participant.getEmail(),
-// participant.getFavoriteList());
-//
-// // Set other field
-// result.setWeight(participant.getWeight());
-// } catch (TopiaException e) {
-// throw new PollenTechnicalException(e);
-// }
-// }
-//
-// public void deleteFavoriteParticipant(String id) {
-// try {
-// FavoriteParticipantDAO dao =
-// PollenDAOHelper.getFavoriteParticipantDAO(getTransaction());
-//
-// FavoriteParticipant participantLoaded = dao.findByTopiaId(id);
-// dao.delete(participantLoaded);
-// } catch (TopiaException e) {
-// throw new PollenTechnicalException(e);
-// }
-// }
-//
-// public FavoriteParticipant getFavoriteParticipant(String id) {
-// try {
-// FavoriteParticipantDAO dao =
-// PollenDAOHelper.getFavoriteParticipantDAO(getTransaction());
-//
-// FavoriteParticipant result = dao.findByTopiaId(id);
-// //No more needed
-//// // Load parent list
-//// result.getFavoriteList();
-//
-// return result;
-// } catch (TopiaException e) {
-// throw new PollenTechnicalException(e);
-// }
-// }
-//
-// public Map<String, FavoriteParticipant> getFavoriteParticipants(EntityFilter filter) {
-// try {
-// FavoriteParticipantDAO dao =
-// PollenDAOHelper.getFavoriteParticipantDAO(getTransaction());
-//
-// PollenQueryHelper.FavoriteParticipantProperty participantProperty =
-// PollenQueryHelper.newFavoriteParticipantProperty();
-//
-// TopiaQuery query = dao.createQueryFindAllByFavoriteList(filter);
-//
-// if (log.isDebugEnabled()) {
-// log.debug("Query : " + query);
-// }
-//
-// query.addLoad(participantProperty.favoriteList());
-//
-// Map<String, FavoriteParticipant> results =
-// dao.findAllMappedByQuery(query);
-//
-// return results;
-// } catch (TopiaException e) {
-// throw new PollenTechnicalException(e);
-// }
-// }
-//
-// public List<FavoriteList> getFavoriteLists(UserAccount user) {
-// try {
-// FavoriteListDAO dao =
-// PollenDAOHelper.getFavoriteListDAO(getTransaction());
-//
-// List<FavoriteList> result = dao.findAllByUserAccount(user);
-//
-// return result;
-// } catch (TopiaException e) {
-// throw new PollenTechnicalException(e);
-// }
-// }
-//
-// public void deleteFavoriteList(FavoriteList list) {
-// try {
-// FavoriteListDAO dao =
-// PollenDAOHelper.getFavoriteListDAO(getTransaction());
-//
-// FavoriteList listLoaded = dao.findByTopiaId(list.getId());
-// dao.delete(listLoaded);
-// } catch (TopiaException e) {
-// throw new PollenTechnicalException(e);
-// }
-// }
-//
-// public void createFavoriteList(FavoriteList list) throws FavoriteListAlreadyExistException {
-// try {
-// FavoriteListDAO dao =
-// PollenDAOHelper.getFavoriteListDAO(getTransaction());
-//
-// // check favoriteList name exist for user
-// UserAccount user = list.getUserAccount();
-//
-// // existing list found
-// if (dao.existByNaturalId(list.getName(), user)) {
-// throw new FavoriteListAlreadyExistException();
-// }
-//
-// dao.create(list.getName(), list.getUserAccount());
-// } catch (TopiaException e) {
-// throw new PollenTechnicalException(e);
-// }
-// }
-//
-// public int getNbFavoriteParticipants(EntityFilter filter) {
-// try {
-// FavoriteParticipantDAO dao =
-// PollenDAOHelper.getFavoriteParticipantDAO(getTransaction());
-//
-// TopiaQuery query = dao.createQueryFindAllByFavoriteList(filter);
-//
-// int result = dao.countByQuery(query);
-// return result;
-// } catch (TopiaException e) {
-// throw new PollenTechnicalException(e);
-// }
-// }
-//
-// public FavoriteParticipant getNewFavoriteParticipant(FavoriteList list) {
-// FavoriteParticipant result = new FavoriteParticipantImpl();
-// result.setFavoriteList(list);
-// result.setWeight(1.);
-// return result;
-// }
-//
-// public FavoriteList getNewFavoriteList(UserAccount user) {
-// FavoriteList result = new FavoriteListImpl();
-// result.setUserAccount(user);
-// return result;
-// }
-//
-// public void updateFavoriteParticipant(FavoriteParticipant participant) throws ParticipantExistWithoutMailException, ParticipantAlreadyFoundInListException {
-// try {
-// FavoriteParticipantDAO dao =
-// PollenDAOHelper.getFavoriteParticipantDAO(getTransaction());
-//
-// checkFavoriteParticipant(dao, participant);
-//
-// FavoriteParticipant participantLoaded =
-// dao.findByTopiaId(participant.getId());
-//
-// // Set all fields except favoriteList that can't be changed
-// participantLoaded.setName(participant.getName());
-// participantLoaded.setEmail(participant.getEmail());
-// participantLoaded.setWeight(participant.getWeight());
-//
-// dao.update(participantLoaded);
-// } catch (TopiaException e) {
-// throw new PollenTechnicalException(e);
-// }
-// }
-//
-// /**
-// * Check if the {@code participant} doesn't already exists with same email,
-// * name and favoriteList.
-// *
-// * @param dao used to verify the existing participant
-// * @param participant FavoriteParticipant to check
-// * @throws TopiaException for technical errors from ToPIA
-// * @throws ParticipantAlreadyFoundInListException
-// * if a participant already exist in list
-// * @throws ParticipantExistWithoutMailException
-// * if a participan was found without email
-// */
-// protected void checkFavoriteParticipant(FavoriteParticipantDAO dao,
-// FavoriteParticipant participant)
-// throws TopiaException, ParticipantExistWithoutMailException, ParticipantAlreadyFoundInListException {
-//
-// FavoriteList list = participant.getFavoriteList();
-//
-// TopiaQuery query = dao.createQuery().
-// addEquals(FavoriteParticipant.PROPERTY_FAVORITE_LIST, list).
-// addEquals(FavoriteParticipant.PROPERTY_NAME, participant.getName()).
-// addEquals(FavoriteParticipant.PROPERTY_EMAIL, participant.getEmail());
-//
-// // Check only on entities different from the one in argument
-// if (StringUtils.isNotEmpty(participant.getId())) {
-// query.addWhere(TopiaEntity.TOPIA_ID, TopiaQuery.Op.NEQ, participant.getId());
-// }
-//
-// // existing participant found
-// if (dao.existByQuery(query)) {
-// // The error type (message) depends on email nullity
-// if (participant.getEmail() == null) {
-// throw new ParticipantExistWithoutMailException();
-// } else {
-// throw new ParticipantAlreadyFoundInListException();
-// }
-// }
-// }
}
Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollCommentService.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollCommentService.java 2012-03-14 14:40:02 UTC (rev 3181)
+++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollCommentService.java 2012-03-14 14:40:57 UTC (rev 3182)
@@ -35,8 +35,7 @@
import org.chorem.pollen.services.PollenServiceSupport;
import org.chorem.pollen.services.exceptions.PollCommentNotFound;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaQuery;
-import org.nuiton.web.struts2.FilterPagerUtil;
+import org.nuiton.topia.persistence.TopiaFilterPagerUtil;
import java.util.List;
@@ -170,28 +169,18 @@
return result;
}
- public List<Comment> getComments(FilterPagerUtil.FilterPagerBean pager,
+ public List<Comment> getComments(TopiaFilterPagerUtil.FilterPagerBean pager,
String pollId) {
Preconditions.checkNotNull(pager);
Preconditions.checkNotNull(pollId);
- CommentDAO dao = getDAO(Comment.class);
-
try {
-
- TopiaQuery countQuery = dao.createQuery("e").
- addWhere("e." + Comment.PROPERTY_POLL + ".pollId",
- TopiaQuery.Op.EQ, pollId);
- long records = dao.countByQuery(countQuery);
- pager.setRecords((int) records);
-
- TopiaQuery query = FilterPagerUtil.addPagerToQuery(countQuery,
- pager);
- List<Comment> result = dao.findAllByQuery(query);
+ CommentDAO dao = getDAO(Comment.class);
+ List<Comment> result = dao.getComments(pager, pollId);
return result;
} catch (TopiaException e) {
- throw new PollenTechnicalException(e);
+ throw new PollenTechnicalException("Could not obtain comments", e);
}
}
@@ -199,18 +188,12 @@
Preconditions.checkNotNull(pollId);
- CommentDAO dao = getDAO(Comment.class);
-
try {
-
- TopiaQuery query = dao.createQuery("e").
- addWhere("e." + Comment.PROPERTY_POLL + ".pollId",
- TopiaQuery.Op.EQ, pollId);
- query.addOrderDesc(Comment.PROPERTY_POST_DATE);
- List<Comment> result = dao.findAllByQuery(query);
+ CommentDAO dao = getDAO(Comment.class);
+ List<Comment> result = dao.getAllComments(pollId);
return result;
} catch (TopiaException e) {
- throw new PollenTechnicalException(e);
+ throw new PollenTechnicalException("Could not obtain comments", e);
}
}
Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java 2012-03-14 14:40:02 UTC (rev 3181)
+++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java 2012-03-14 14:40:57 UTC (rev 3182)
@@ -24,7 +24,6 @@
package org.chorem.pollen.services.impl;
import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -50,12 +49,13 @@
import org.chorem.pollen.common.ChoiceType;
import org.chorem.pollen.common.PollType;
import org.chorem.pollen.services.PollenServiceSupport;
+import org.chorem.pollen.services.exceptions.PollAccountNotFound;
import org.chorem.pollen.services.exceptions.PollChoiceNotFoundException;
import org.chorem.pollen.services.exceptions.PollNotFoundException;
import org.chorem.pollen.services.exceptions.PollVoteNotFoundException;
+import org.chorem.pollen.services.exceptions.UnauthorizedPollAccessException;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaQuery;
-import org.nuiton.web.struts2.FilterPagerUtil;
+import org.nuiton.topia.persistence.TopiaFilterPagerUtil;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
@@ -281,52 +281,33 @@
return url.toString();
}
- public List<Poll> getPolls(FilterPagerUtil.FilterPagerBean pager) {
+ public List<Poll> getPolls(TopiaFilterPagerUtil.FilterPagerBean pager) {
Preconditions.checkNotNull(pager);
-
- PollDAO dao = getDAO(Poll.class);
-
try {
-
- long records = dao.count();
- pager.setRecords((int) records);
-
- TopiaQuery query = dao.createQuery("e");
- FilterPagerUtil.addPagerToQuery(query, pager);
-
- List<Poll> result = dao.findAllByQuery(query);
+ PollDAO dao = getDAO(Poll.class);
+ List<Poll> result = dao.getPolls(pager);
return result;
} catch (TopiaException e) {
- throw new PollenTechnicalException(e);
+ throw new PollenTechnicalException("Could not obtain polls", e);
}
}
- public List<Poll> getCreatedPolls(FilterPagerUtil.FilterPagerBean pager,
+ public List<Poll> getCreatedPolls(TopiaFilterPagerUtil.FilterPagerBean pager,
UserAccount user) {
Preconditions.checkNotNull(pager);
Preconditions.checkNotNull(user);
-
- PollDAO dao = getDAO(Poll.class);
-
try {
-
- TopiaQuery countQuery = dao.createQuery("e");
- countQuery.addWhere("e." + Poll.PROPERTY_CREATOR + "." + PollAccount.PROPERTY_USER_ACCOUNT, TopiaQuery.Op.EQ, user);
- long records = dao.countByQuery(countQuery);
- pager.setRecords((int) records);
-
- TopiaQuery query = FilterPagerUtil.addPagerToQuery(countQuery, pager);
-
- List<Poll> result = dao.findAllByQuery(query);
+ PollDAO dao = getDAO(Poll.class);
+ List<Poll> result = dao.getCreatedPolls(pager, user);
return result;
} catch (TopiaException e) {
- throw new PollenTechnicalException(e);
+ throw new PollenTechnicalException("Could not obtain created polls", e);
}
}
- public List<Poll> getInvitedPolls(FilterPagerUtil.FilterPagerBean pager,
+ public List<Poll> getInvitedPolls(TopiaFilterPagerUtil.FilterPagerBean pager,
UserAccount user) {
Preconditions.checkNotNull(pager);
@@ -336,36 +317,15 @@
UserAccount userToUse = userService.getEntityById(UserAccount.class,
user.getTopiaId());
- //FIXME Use a query to do this to avoid in memory pagination
- String email = userToUse.getEmail();
-
- List<Poll> polls = userService.getEntities(Poll.class);
- List<Poll> allPolls = Lists.newLinkedList();
- for (Poll poll : polls) {
- for (VotingList votingList : poll.getVotingList()) {
- for (PersonToList personToList : votingList
- .getPollAccountPersonToList()) {
- if (!personToList.isHasVoted()) {
- PollAccount pollAccount = personToList
- .getPollAccount();
-
- if (pollAccount != null
- && pollAccount.getEmail() != null
- && pollAccount.getEmail().equals(
- email)) {
- allPolls.add(poll);
- }
- }
- }
- }
+ Preconditions.checkNotNull(userToUse);
+ try {
+ PollDAO pollDao = getDAO(Poll.class);
+ List<Poll> result = pollDao.getInvitedPolls(pager, userToUse);
+ return result;
+ } catch (TopiaException e) {
+ throw new PollenTechnicalException("Could not obtain invited polls", e);
}
- int records = allPolls.size();
- pager.setRecords(records);
-
- List<Poll> result = FilterPagerUtil.getPageFromList(allPolls, pager);
- return result;
-
// try {
// PollDAO dao = PollenDAOHelper.getPollDAO(getTransaction());
// TopiaQuery countQuery = dao.createQuery("e");
@@ -375,7 +335,7 @@
//
// PagerUtil.computeRecordIndexesAndPagesNumber(pager);
// TopiaQuery query = dao.createQuery("e");
-// FilterPagerUtil.addPagerToQuery(pager, query);
+// TopiaFilterPagerUtil.addPagerToQuery(pager, query);
// query.addWhere("e." + Poll.PROPERTY_CREATOR + "." + PollAccount.PROPERTY_USER_ACCOUNT, TopiaQuery.Op.EQ, user);
//
// List<Poll> result = dao.findAllByQuery(query);
@@ -385,89 +345,43 @@
// }
}
- public List<Poll> getParticipatedPolls(FilterPagerUtil.FilterPagerBean pager,
+ public List<Poll> getParticipatedPolls(TopiaFilterPagerUtil.FilterPagerBean pager,
UserAccount user) {
Preconditions.checkNotNull(pager);
Preconditions.checkNotNull(user);
- //FIXME Use a query to do this to avoid in memory pagination
-
UserService userService = newService(UserService.class);
UserAccount userToUse =
userService.getEntityById(UserAccount.class, user.getTopiaId());
- PollDAO pollDao = getDAO(Poll.class);
- VoteDAO voteDao = getDAO(Vote.class);
+ Preconditions.checkNotNull(userToUse);
try {
-
- TopiaQuery countQuery = voteDao.createQuery("e").
- addDistinct().
- setSelect("e." + Vote.PROPERTY_POLL).
- addWhere("e." + Vote.PROPERTY_POLL_ACCOUNT + "." + PollAccount.PROPERTY_USER_ACCOUNT, TopiaQuery.Op.EQ, userToUse);
-
- long records = pollDao.countByQuery(countQuery);
- pager.setRecords((int) records);
-
- TopiaQuery query = FilterPagerUtil.addPagerToQuery(countQuery, pager);
-
- List<Poll> result = pollDao.findAllByQuery(query);
+ PollDAO pollDao = getDAO(Poll.class);
+ List<Poll> result = pollDao.getParticipatedPolls(pager, userToUse);
return result;
} catch (TopiaException e) {
- throw new PollenTechnicalException(e);
+ throw new PollenTechnicalException("Could not obtain running polls", e);
}
}
public List<Poll> getRunningPolls(boolean withEndDate) {
- List<Poll> results;
try {
-
PollDAO dao = getDAO(Poll.class);
-
- TopiaQuery query;
-
- if (withEndDate) {
-
- query = dao.createQuery("poll").
- addWhere("poll.endDate is not null and poll.endDate > current_timestamp()").
- addWhere("poll.beginDate is null or poll.beginDate < current_timestamp()");
-
-// results = transaction
-// .find("from "
-// + Poll.class.getName()
-// + " as poll where (poll.endDate is not null and poll.endDate > current_timestamp())"
-// + " and (poll.beginDate is null or poll.beginDate < current_timestamp())");
- } else {
- query = dao.createQuery("poll").
- addWhere("poll.endDate is null or poll.endDate > current_timestamp()").
- addWhere("poll.beginDate is null or poll.beginDate < current_timestamp()");
-
-// results = transaction
-// .find("from "
-// + Poll.class.getName()
-// + " as poll where (poll.endDate is null or poll.endDate > current_timestamp())"
-// + " and (poll.beginDate is null or poll.beginDate < current_timestamp())");
- }
-
- results = dao.findAllByQuery(query);
-
- if (log.isDebugEnabled()) {
- log.debug("Entities found: "
- + ((results == null) ? "null" : results.size()));
- }
+ List<Poll> results = dao.getRunningPolls(withEndDate);
return results;
} catch (TopiaException e) {
- throw new PollenTechnicalException("Culd not obtain polls", e);
+ throw new PollenTechnicalException("Could not obtain running polls", e);
}
}
public Poll getPollByPollId(String pollId) {
Preconditions.checkNotNull(pollId);
- PollDAO dao = getDAO(Poll.class);
try {
+ PollDAO dao = getDAO(Poll.class);
Poll result = dao.findByPollId(pollId);
return result;
} catch (TopiaException e) {
@@ -488,8 +402,8 @@
}
public PollAccount getPollAccountByAccountId(String accountId) {
- PollAccountDAO dao = getDAO(PollAccount.class);
try {
+ PollAccountDAO dao = getDAO(PollAccount.class);
PollAccount result = dao.findByAccountId(accountId);
return result;
} catch (TopiaException e) {
@@ -497,6 +411,40 @@
}
}
+ public void deletePoll(String pollId,
+ UserAccount userAccount,
+ String accountId) throws PollNotFoundException, PollAccountNotFound, UnauthorizedPollAccessException {
+
+ Preconditions.checkNotNull(pollId);
+ Preconditions.checkNotNull(accountId);
+
+ Poll poll = getPollByPollId(pollId);
+
+ if (poll == null) {
+ throw new PollNotFoundException();
+ }
+
+ if (userAccount == null || userAccount.isAdministrator()) {
+
+ // must check that accountId matches the poll creator id
+
+ PollAccount account = getPollAccountByAccountId(accountId);
+
+ if (account == null) {
+ throw new PollAccountNotFound();
+ }
+
+ if (!account.getAccountId().equals(poll.getCreator().getAccountId())) {
+ throw new UnauthorizedPollAccessException();
+ }
+ }
+
+ PollDAO dao = getDAO(Poll.class);
+ delete(dao, poll);
+
+ commitTransaction("Could not delete poll" + poll.getTitle());
+ }
+
public void deleteVote(String pollId, String voteId)
throws PollNotFoundException, PollVoteNotFoundException {
Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/UserService.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/UserService.java 2012-03-14 14:40:02 UTC (rev 3181)
+++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/UserService.java 2012-03-14 14:40:57 UTC (rev 3182)
@@ -38,11 +38,10 @@
import org.chorem.pollen.services.exceptions.UserLoginAlreadyUsedException;
import org.chorem.pollen.services.exceptions.UserNotFoundException;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaQuery;
+import org.nuiton.topia.persistence.TopiaFilterPagerUtil;
import org.nuiton.topia.persistence.util.TopiaEntityBinder;
import org.nuiton.util.StringUtil;
import org.nuiton.util.beans.Binder;
-import org.nuiton.web.struts2.FilterPagerUtil;
import java.util.List;
@@ -177,15 +176,8 @@
// In case of email change, check if an other user has not already
// the new email
- // FIXME-fdesbois-20100510 : replace by using id directly
- TopiaQuery query = dao.createQuery().
- addWhere(UserAccount.PROPERTY_LOGIN,
- TopiaQuery.Op.NEQ, user.getLogin());
- query.addEquals(UserAccount.PROPERTY_EMAIL,
- StringUtils.lowerCase(user.getEmail()));
-
// existing user found
- if (dao.existByQuery(query)) {
+ if (dao.isUserExist(user)) {
throw new UserEmailAlreadyUsedException();
}
@@ -221,21 +213,13 @@
}
}
- public List<UserAccount> getUsers(FilterPagerUtil.FilterPagerBean pager) {
+ public List<UserAccount> getUsers(TopiaFilterPagerUtil.FilterPagerBean pager) {
Preconditions.checkNotNull(pager);
- UserAccountDAO dao = getDAO(UserAccount.class);
-
try {
-
- long records = dao.count();
- pager.setRecords((int) records);
-
- TopiaQuery query = dao.createQuery("e");
- FilterPagerUtil.addPagerToQuery(query, pager);
-
- List<UserAccount> result = dao.findAllByQuery(query);
+ UserAccountDAO dao = getDAO(UserAccount.class);
+ List<UserAccount> result = dao.getUsers(pager);
return result;
} catch (TopiaException e) {
throw new PollenTechnicalException(e);
Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/VoteService.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/VoteService.java 2012-03-14 14:40:02 UTC (rev 3181)
+++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/VoteService.java 2012-03-14 14:40:57 UTC (rev 3182)
@@ -37,8 +37,8 @@
import org.chorem.pollen.services.exceptions.VoteNotFoundException;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.persistence.TopiaFilterPagerUtil;
-import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -108,7 +108,6 @@
// feed notification
-
}
public void updateVote(Vote vote) throws VoteNotFoundException {
@@ -126,7 +125,6 @@
}
commitTransaction("Could not update vote");
-
}
public void deleteVote(String voteId) throws VoteNotFoundException {
@@ -137,7 +135,8 @@
throw new VoteNotFoundException();
}
- delete(getDAO(Vote.class), entityToDelete);
+ VoteDAO dao = getDAO(Vote.class);
+ delete(dao, entityToDelete);
if (log.isDebugEnabled()) {
log.debug("Entity deleted: " + voteId);
@@ -147,73 +146,27 @@
}
public List<Vote> getVotesByPoll(Poll poll,
- int startIndex, int endIndex) {
- TopiaContext transaction = getTransaction();
- List<Vote> results = new ArrayList<Vote>();
+ TopiaFilterPagerUtil.FilterPagerBean pager) {
try {
- // No need to load votes for an anonymous poll
- if (poll.isAnonymous()) {
- return results;
- }
+ VoteDAO dao = getDAO(Vote.class);
+ List<Vote> results = dao.getVotesByPoll(poll, pager);
+ return results;
- // FIXME-FD20100309 : change model to suppress link from poll to vote
- // It's not necessary to have votes when retrieving the poll, this
- // method do this job only when it's needed
-
- if (log.isDebugEnabled()) {
- log.debug("Load votes for poll with uid = " + poll.getPollId());
- log.debug("LIMIT : startIndex = " + startIndex + " _ " +
- "endIndex = " + endIndex);
- }
-
- // FIXME : refactor this to use TopiaQuery from ToPIA 2.3
- // Order the results by creation date (the last vote done will be
- // at the end of the list)
- List<Vote> votes = transaction.find(
- "FROM " + Vote.class.getName() +
- " WHERE poll.pollId = :pollUId" +
- " ORDER BY topiaCreateDate",
- startIndex, endIndex,
- new Object[]{"pollUId", poll.getPollId()});
-
- if (log.isDebugEnabled()) {
- log.debug("Nb votes found : " + votes.size());
- }
-
- results = Lists.newArrayList(results);
-
} catch (TopiaException e) {
throw new PollenTechnicalException("Could not obtain votes", e);
}
- return results;
}
public boolean hasAlreadyVoted(String votingId, Poll poll) {
- TopiaContext transaction = getTransaction();
- boolean result = false;
try {
-
- // Test using a count(*) on votes
- List<Long> tmp = transaction.find(
- "SELECT COUNT(*)" +
- " FROM " + Vote.class.getName() +
- " WHERE poll.pollId = :pollUId" +
- " AND pollAccount.votingId = :votingId",
- "pollUId", poll.getPollId(),
- "votingId", votingId);
-
- int count = tmp.get(0).intValue();
-
- // If the count is greater than 0, there is an existing votingId
- // who has already voted for the poll
- result = count > 0;
-
+ VoteDAO dao = getDAO(Vote.class);
+ boolean result = dao.hasAlreadyVoted(votingId, poll);
+ return result;
} catch (Exception e) {
throw new PollenTechnicalException(
"Unable test vote existing for account with votingId = " +
votingId + " and poll with uid = " + poll.getPollId(), e);
}
- return result;
}
public List<Vote> selectVotes(Map<String, Object> properties) {
1
0