This is an automated email from the git hooks/post-receive script. New commit to branch feature/1110 in repository pollen. See http://git.chorem.org/pollen.git commit 8f30a8ffc4b193c3bfe19da823079c90d07b9eab Author: Yannick Martel <yannick.martel@gmail.com> Date: Fri Oct 24 17:20:29 2014 +0200 #1110 [poll export] add Resource on a Poll for external resources choice --- .../org/chorem/pollen/io/PollenDataStorage.java | 34 +++++++++++++--------- .../main/java/org/chorem/pollen/io/dto/Poll.java | 10 +++++++ 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/pollen-io-api/src/main/java/org/chorem/pollen/io/PollenDataStorage.java b/pollen-io-api/src/main/java/org/chorem/pollen/io/PollenDataStorage.java index 5e3067b..4c1d747 100644 --- a/pollen-io-api/src/main/java/org/chorem/pollen/io/PollenDataStorage.java +++ b/pollen-io-api/src/main/java/org/chorem/pollen/io/PollenDataStorage.java @@ -1,5 +1,19 @@ package org.chorem.pollen.io; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Type; +import java.util.Date; +import java.util.Enumeration; +import java.util.LinkedHashSet; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipOutputStream; + import com.google.common.collect.ImmutableSet; import com.google.gson.ExclusionStrategy; import com.google.gson.FieldAttributes; @@ -25,20 +39,6 @@ import org.chorem.pollen.io.dto.PollenResource; import org.chorem.pollen.io.dto.PollenResourceZipEntry; import org.chorem.pollen.io.dto.PollenUser; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.lang.reflect.Type; -import java.util.Date; -import java.util.Enumeration; -import java.util.LinkedHashSet; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; -import java.util.zip.ZipOutputStream; - /** * Created on 9/19/14. * @@ -278,6 +278,12 @@ public class PollenDataStorage { } IOUtils.write(json, outputStream); + if (id instanceof Poll) { + Set<PollenResource> resources = ((Poll) id).getResources(); + for (PollenResource resource : resources) { + store(zipEntry.getName() + ".resources", resource, outputStream); + } + } } protected void store(String prefix, PollenResource resource, ZipOutputStream outputStream) throws IOException { diff --git a/pollen-io-api/src/main/java/org/chorem/pollen/io/dto/Poll.java b/pollen-io-api/src/main/java/org/chorem/pollen/io/dto/Poll.java index 6f2934d..2889919 100644 --- a/pollen-io-api/src/main/java/org/chorem/pollen/io/dto/Poll.java +++ b/pollen-io-api/src/main/java/org/chorem/pollen/io/dto/Poll.java @@ -44,6 +44,8 @@ public class Poll extends Id { protected final Set<Choice> choices; + protected final Set<PollenResource> resources; + protected final Set<Comment> comments; protected final Set<Vote> votes; @@ -53,6 +55,7 @@ public class Poll extends Id { choices = new LinkedHashSet<>(); comments = new LinkedHashSet<>(); votes = new LinkedHashSet<>(); + resources = new LinkedHashSet<>(); } public String getTitle() { @@ -207,6 +210,13 @@ public class Poll extends Id { choices.add(choice); } + public Set<PollenResource> getResources() { + return resources; + } + + public void addResource(PollenResource resource) { + resources.add(resource); + } public Set<Comment> getComments() { return comments; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.