# HG changeset patch # User Felix Wolfsteller # Date 1314192075 0 # Node ID e699adf3b092bad0aa5030790c479d24e689a2d6 # Parent 18fc7afe025134ccc575b700a48ce756d644b413 Fix loading of recommendations when collection is not yet in place. flys-client/trunk@2561 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 18fc7afe0251 -r e699adf3b092 flys-client/ChangeLog --- a/flys-client/ChangeLog Wed Aug 24 13:17:22 2011 +0000 +++ b/flys-client/ChangeLog Wed Aug 24 13:21:15 2011 +0000 @@ -1,3 +1,13 @@ +2011-08-24 Felix Wolfsteller + + Fix loading of recommendations when collection is not yet in place. + + * src/main/java/de/intevation/flys/client/client/ui/CollectionView.java + (createNewCollection): + Load recommendations when new Collection is created. + (onParameterChange): + Guard call to loadRecommendation to avoid NPE when no collection is yet set. + 2011-08-24 Felix Wolfsteller * src/main/java/de/intevation/flys/client/shared/model/DefaultCollection.java: diff -r 18fc7afe0251 -r e699adf3b092 flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java Wed Aug 24 13:17:22 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java Wed Aug 24 13:21:15 2011 +0000 @@ -226,6 +226,14 @@ Artifact artifact = getArtifact(); addArtifactToCollection(artifact); + // Load recommendations, if any. + ArtifactDescription desc = + artifact.getArtifactDescription(); + Recommendation[] recom = desc.getRecommendations(); + + if (recom != null && collection != null) { + loadRecommendedArtifacts(recom); + } } }); } @@ -335,14 +343,14 @@ OutputMode[] outs = desc.getOutputModes(); Recommendation[] recom = desc.getRecommendations(); - if (recom != null) { - loadRecommendedArtifacts(recom); - } - setArtifact(art); Collection c = getCollection(); + if (recom != null && collection != null) { + loadRecommendedArtifacts(recom); + } + if (outs != null && c == null) { User user = getFlys().getCurrentUser(); createNewCollection(user.identifier()); @@ -612,7 +620,6 @@ return; } - for (final Recommendation recommendation: recommendations) { if (collection.loadedRecommendation(recommendation)) { continue;