# HG changeset patch # User Andre Heinecke # Date 1370006455 -7200 # Node ID 8d9859d776e520002feb69a1c17006b6f92ff31a # Parent 804e50149d6ad0bdba933a1023a1fd98d75a524f Handle target_out in the Recommendation / Client datacage code. diff -r 804e50149d6a -r 8d9859d776e5 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DatacageWidget.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DatacageWidget.java Fri May 31 15:19:32 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DatacageWidget.java Fri May 31 15:20:55 2013 +0200 @@ -381,6 +381,7 @@ String name = node.getAttribute("facet"); String ids = node.getAttribute("ids"); String displayname = node.getAttribute("name"); + String targetOut = node.getAttribute("target_out"); String debugAttributeValues = ""; for (String attr: node.getAttributes()) { debugAttributeValues += ("[" + attr +": " @@ -394,7 +395,8 @@ out, name, ids, - displayname); + displayname, + targetOut); } TreeNode [] children = tree.getChildren(node); if (children != null) { diff -r 804e50149d6a -r 8d9859d776e5 gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactDescriptionFactory.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactDescriptionFactory.java Fri May 31 15:19:32 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactDescriptionFactory.java Fri May 31 15:20:55 2013 +0200 @@ -575,12 +575,15 @@ Recommendation[] rec = new Recommendation[num]; for (int i = 0; i < num; i++) { - Element e = (Element) list.item(i); - String factory = e.getAttribute("factory"); - String index = e.getAttribute("ids"); + Element e = (Element) list.item(i); + String factory = e.getAttribute("factory"); + String index = e.getAttribute("ids"); + String targetOut = e.getAttribute("target_out"); if (factory != null && factory.length() > 0) { - rec[i] = new Recommendation(factory, index); + logger.debug("Adding Recommendation. Factory: " + factory + + " IDs: " + index + " target out " + targetOut); + rec[i] = new Recommendation(factory, index, null, null, targetOut); } } diff -r 804e50149d6a -r 8d9859d776e5 gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactHelper.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactHelper.java Fri May 31 15:19:32 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactHelper.java Fri May 31 15:20:55 2013 +0200 @@ -71,20 +71,23 @@ String uuid; String ids; CreationFilter filter; + String targetOut; if (recommendation != null) { - uuid = recommendation.getMasterArtifact(); - ids = recommendation.getIDs(); - filter = convertFilter(recommendation.getFilter()); + uuid = recommendation.getMasterArtifact(); + ids = recommendation.getIDs(); + filter = convertFilter(recommendation.getFilter()); + targetOut = recommendation.getTargetOut(); } else { - uuid = null; - ids = null; - filter = null; + uuid = null; + ids = null; + filter = null; + targetOut = null; } Document create = ClientProtocolUtils.newCreateDocument( - factory, uuid, ids, filter); + factory, uuid, ids, filter, targetOut); return sendCreate(serverUrl, locale, create); diff -r 804e50149d6a -r 8d9859d776e5 gwt-client/src/main/java/org/dive4elements/river/client/shared/model/Recommendation.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/Recommendation.java Fri May 31 15:19:32 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/Recommendation.java Fri May 31 15:20:55 2013 +0200 @@ -117,6 +117,9 @@ protected String masterArtifact; /** Optional facet filter. */ protected Filter filter; + /** The out this Artifact should be added to **/ + protected String targetOut; + protected String displayName = null; public Recommendation() { @@ -126,16 +129,39 @@ this(factory, ids, null, null); } + public Recommendation(String factory, String ids, String targetOut) { + this(factory, ids, null, null, targetOut); + } + public Recommendation( String factory, String ids, String masterArtifact, Filter filter ) { + this(factory, ids, masterArtifact, filter, null); + } + + public Recommendation( + String factory, + String ids, + String masterArtifact, + Filter filter, + String targetOut + ) { this.factory = factory; this.ids = ids; this.masterArtifact = masterArtifact; this.filter = filter; + this.targetOut = targetOut; + } + + public String getTargetOut() { + return targetOut; + } + + public void setTargetOut(String value) { + targetOut = value; } public String getFactory() { @@ -190,6 +216,9 @@ hash += (getMasterArtifact() != null) ? getMasterArtifact().hashCode() : 0; + hash += (getTargetOut() != null) + ? getTargetOut().hashCode() + : 0; return hash; } @@ -221,7 +250,8 @@ return (same(this.getFactory(), rec.getFactory())) && (same(this.getIDs(), rec.getIDs())) && (same(this.getFilter(), rec.getFilter())) - && (same(this.getMasterArtifact(), rec.getMasterArtifact())); + && (same(this.getMasterArtifact(), rec.getMasterArtifact())) + && (same(this.getTargetOut(), rec.getTargetOut())); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 804e50149d6a -r 8d9859d776e5 gwt-client/src/main/java/org/dive4elements/river/client/shared/model/ToLoad.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/ToLoad.java Fri May 31 15:19:32 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/ToLoad.java Fri May 31 15:20:55 2013 +0200 @@ -15,6 +15,8 @@ import java.io.Serializable; +import com.google.gwt.core.client.GWT; + public class ToLoad implements Serializable { @@ -49,6 +51,16 @@ } return key; } + public void add( + String artifactName, + String factory, + String out, + String name, + String ids, + String displayName + ) { + add(artifactName, factory, out, name, ids, displayName, null); + } public void add( String artifactName, @@ -56,8 +68,13 @@ String out, String name, String ids, - String displayName + String displayName, + String targetOut ) { + GWT.log("Adding artifact: " + artifactName + " Factory: " + factory + + " Out: " + out + " Name: " + name + " Ids: " + ids + + " Display Name: " + displayName + " Target Out: " + targetOut); + if (artifactName == null) { artifactName = uniqueKey(artifacts); }