[pollen_1.x] branch feature/1112 updated (68590fb -> 323038a)
This is an automated email from the git hooks/post-receive script. New change to branch feature/1112 in repository pollen_1.x. See http://git.chorem.org/pollen_1.x.git from 68590fb refs #1110 introduce admin action new 323038a fix comments export and ChoiceType management (TODO : manage image export) The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 323038a2751f604307578db39a5d9310ceb15f1c Author: Yannick Martel <yannick.martel@gmail.com> Date: Wed Oct 22 17:56:37 2014 +0200 fix comments export and ChoiceType management (TODO : manage image export) Summary of changes: .../pollen/services/impl/PollenExportService.java | 58 ++++++++++------------ 1 file changed, 26 insertions(+), 32 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/1112 in repository pollen_1.x. See http://git.chorem.org/pollen_1.x.git commit 323038a2751f604307578db39a5d9310ceb15f1c Author: Yannick Martel <yannick.martel@gmail.com> Date: Wed Oct 22 17:56:37 2014 +0200 fix comments export and ChoiceType management (TODO : manage image export) --- .../pollen/services/impl/PollenExportService.java | 58 ++++++++++------------ 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollenExportService.java b/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollenExportService.java index 0557181..84b2850 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollenExportService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollenExportService.java @@ -1,8 +1,11 @@ package org.chorem.pollen.services.impl; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + import org.chorem.pollen.PollenTechnicalException; -import org.chorem.pollen.bean.PollDateChoice; -import org.chorem.pollen.bean.PollImageChoice; import org.chorem.pollen.business.persistence.PersonList; import org.chorem.pollen.business.persistence.PersonToList; import org.chorem.pollen.business.persistence.PollAccount; @@ -33,11 +36,6 @@ import org.chorem.pollen.io.dto.VoterListMember; import org.chorem.pollen.services.PollenServiceContext; import org.chorem.pollen.services.PollenServiceSupport; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - /** * Created on 9/19/14. * @@ -149,7 +147,7 @@ public class PollenExportService extends PollenServiceSupport { for (org.chorem.pollen.business.persistence.Choice incomingChoice : incomingPoll.getChoice()) { - Choice choice = extractChoice(creator, incomingChoice, choiceOrder++); + Choice choice = extractChoice(creator, incomingChoice, choiceOrder++, incomingPoll.getChoiceType()); poll.addChoice(choice); choiceIds.add(incomingChoice.getTopiaId()); @@ -269,7 +267,7 @@ public class PollenExportService extends PollenServiceSupport { } - protected Choice extractChoice(PollenPrincipal creator, org.chorem.pollen.business.persistence.Choice incomingChoice, int choiceOrder) { + protected Choice extractChoice(PollenPrincipal creator, org.chorem.pollen.business.persistence.Choice incomingChoice, int choiceOrder, org.chorem.pollen.business.persistence.ChoiceType incomingChoiceType) { Choice choice = new Choice(); choice.setChoiceOrder(choiceOrder); @@ -279,25 +277,18 @@ public class PollenExportService extends PollenServiceSupport { ChoiceType choiceType; - if (incomingChoice instanceof PollDateChoice) { - - // resource choice - choiceType = ChoiceType.DATE; - - } else if (incomingChoice instanceof PollImageChoice) { - - // resource choice - choiceType = ChoiceType.RESOURCE; - - } else { - - // text choice - choiceType = ChoiceType.TEXT; - + switch (incomingChoiceType) { + case DATE: + choiceType = ChoiceType.DATE; + break; + case IMAGE: + choiceType = ChoiceType.RESOURCE; + break; + default: + choiceType = ChoiceType.TEXT; } choice.setChoiceType(choiceType); - return choice; } @@ -323,15 +314,18 @@ public class PollenExportService extends PollenServiceSupport { PollenPrincipal pollenPrincipal = new PollenPrincipal(); - if (incomingPrincipal.getUserAccount() != null) { - pollenPrincipal.setEmail(incomingPrincipal.getUserAccount().getEmail()); - } + if (incomingPrincipal != null) { - pollenPrincipal.setEmail(incomingPrincipal.getEmail()); + if (incomingPrincipal.getUserAccount() != null) { + pollenPrincipal.setEmail(incomingPrincipal.getUserAccount().getEmail()); + } - PollenToken permission = new PollenToken(); - permission.setToken(incomingPrincipal.getAccountId()); - pollenPrincipal.setPermission(permission); + pollenPrincipal.setEmail(incomingPrincipal.getEmail()); + + PollenToken permission = new PollenToken(); + permission.setToken(incomingPrincipal.getAccountId()); + pollenPrincipal.setPermission(permission); + } return pollenPrincipal; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm