# HG changeset patch # User Felix Wolfsteller # Date 1326448239 0 # Node ID e8706fec0ee9f75b9fdacc873f6829187b078c82 # Parent a9388fba0b4620f3fa8992791b54ec71ff5b23d1 Added feedMany() implementation to feed-service. flys-client/trunk@3671 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r a9388fba0b46 -r e8706fec0ee9 flys-client/ChangeLog --- a/flys-client/ChangeLog Fri Jan 13 09:47:27 2012 +0000 +++ b/flys-client/ChangeLog Fri Jan 13 09:50:39 2012 +0000 @@ -1,3 +1,14 @@ +2012-01-13 Felix Wolfsteller + + Added feedMany() function to FeedService to feed multiple artifacts + at once. + + * src/main/java/de/intevation/flys/client/client/services/FeedService.java, + src/main/java/de/intevation/flys/client/client/services/FeedServiceAsync.java, + src/main/java/de/intevation/flys/client/server/FeedServiceImpl.java: + (feedMany): New. Still issue single feeds per artifact but with only + one async callback. + 2012-01-13 Felix Wolfsteller Cosmetics. diff -r a9388fba0b46 -r e8706fec0ee9 flys-client/src/main/java/de/intevation/flys/client/client/services/FeedService.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/services/FeedService.java Fri Jan 13 09:47:27 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/services/FeedService.java Fri Jan 13 09:50:39 2012 +0000 @@ -1,5 +1,7 @@ package de.intevation.flys.client.client.services; +import java.util.List; + import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; @@ -27,5 +29,21 @@ Artifact artifact, Data[] data) throws ServerException; + + + /** + * Inserts (the same) new data into existing artifacts. + * + * @param locale The locale used for the request. + * @param artifact The artifact. + * @param data The data that should be inserted. + * + * @return the artifact which description might have been changed. + */ + public List feedMany( + String locale, + List artifacts, + Data[] data) + throws ServerException; } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r a9388fba0b46 -r e8706fec0ee9 flys-client/src/main/java/de/intevation/flys/client/client/services/FeedServiceAsync.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/services/FeedServiceAsync.java Fri Jan 13 09:47:27 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/services/FeedServiceAsync.java Fri Jan 13 09:50:39 2012 +0000 @@ -1,5 +1,7 @@ package de.intevation.flys.client.client.services; +import java.util.List; + import com.google.gwt.user.client.rpc.AsyncCallback; import de.intevation.flys.client.shared.model.Artifact; @@ -11,10 +13,30 @@ */ public interface FeedServiceAsync { + /** + * Inserts new data into an existing artifact. + * + * @param locale The locale used for the request. + * @param artifact The artifact. + * @param data The data that should be inserted. + */ public void feed( String locale, Artifact artifact, Data[] data, AsyncCallback callback); + + /** + * Inserts (the same) new data into existing artifacts. + * + * @param locale The locale used for the request. + * @param artifact The artifact. + * @param data The data that should be inserted. + */ + public void feedMany( + String locale, + List artifacts, + Data[] data, + AsyncCallback> callback); } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r a9388fba0b46 -r e8706fec0ee9 flys-client/src/main/java/de/intevation/flys/client/server/FeedServiceImpl.java --- a/flys-client/src/main/java/de/intevation/flys/client/server/FeedServiceImpl.java Fri Jan 13 09:47:27 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/FeedServiceImpl.java Fri Jan 13 09:50:39 2012 +0000 @@ -1,5 +1,8 @@ package de.intevation.flys.client.server; +import java.util.ArrayList; +import java.util.List; + import org.w3c.dom.Document; import org.apache.log4j.Logger; @@ -112,6 +115,37 @@ /** + * Triggers FEED operation, many artifacts, same data item(s). + * + * @param artifacts Artifacts that shall be fed. + * @param data An array of Data objects that contain the information that + * are used for the FEED operation. + * + * @return a new artifact parsed from the description of FEED. + */ + public List feedMany( + String locale, + List artifacts, + Data[] data) + throws ServerException + { + logger.info("StepForwardServiceImpl.feedMany"); + + String url = getServletContext().getInitParameter("server-url"); + + List resultArtifacts = new ArrayList(); + + for (Artifact artifact: artifacts) { + logger.info("feedMany: Relay to StepForwardServiceImpl.feed"); + Artifact fedArtifact = feed(locale, artifact, data); + resultArtifacts.add(fedArtifact); + } + + return resultArtifacts; + } + + + /** * This method creates an array of key/value pairs from an array of Data * objects. The string array is used as parameter for the feed() operation. *