Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/shared/model/Recommendation.java @ 5861:172338b1407f
GWT client: Added copyright header.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Sun, 28 Apr 2013 14:30:15 +0200 |
parents | 5aa05a7a34b7 |
children | ea9eef426962 |
rev | line source |
---|---|
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
9 package org.dive4elements.river.client.shared.model; |
807
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
845
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
11 |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
12 import java.util.List; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
13 import java.util.Map; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
14 import java.util.HashMap; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
15 |
807
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import java.io.Serializable; |
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 /** |
1442
4a6814be92ba
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
19 * Information bundle to let client create/clone an artifact with facets. |
807
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 */ |
839
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
22 public class Recommendation implements Serializable { |
807
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 |
1271
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
24 /** Index and name of a facet. */ |
845
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
25 public static class Facet implements Serializable { |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
26 |
1442
4a6814be92ba
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
27 /** Facet name. */ |
845
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
28 protected String name; |
1543
0b79630e3bcb
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1442
diff
changeset
|
29 |
0b79630e3bcb
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1442
diff
changeset
|
30 /** Facet index. */ |
845
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
31 protected String index; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
32 |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
33 public Facet() { |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
34 } |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
35 |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
36 public Facet(String name, String index) { |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
37 this.name = name; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
38 this.index = index; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
39 } |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
40 |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
41 public String getName() { |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
42 return name; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
43 } |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
44 |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
45 public String getIndex() { |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
46 return index; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
47 } |
1271
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
48 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
49 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
50 @Override |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
51 public int hashCode() { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
52 int hash = 0; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
53 if (getName() != null) { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
54 hash += getName().hashCode(); |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
55 } |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
56 if (getIndex() != null) { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
57 hash += getIndex().hashCode(); |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
58 } |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
59 return hash; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
60 } |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
61 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
62 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
63 @Override |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
64 public boolean equals(Object other) { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
65 if (!(other instanceof Facet) || other == null) { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
66 return false; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
67 } |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
68 Facet facet = (Facet) other; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
69 return (same(facet.getIndex(), this.getIndex())) |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
70 && (same(facet.getName(), this.getName())); |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
71 } |
845
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
72 } // class Facet |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
73 |
1271
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
74 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
75 /** Mapping of outnames to Facet-Lists. */ |
845
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
76 public static class Filter implements Serializable { |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
77 |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
78 protected Map<String, List<Facet>> outs; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
79 |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
80 public Filter() { |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
81 outs = new HashMap<String, List<Facet>>(); |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
82 } |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
83 |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
84 public void add(String out, List<Facet> facets) { |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
85 outs.put(out, facets); |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
86 } |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
87 |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
88 public Map<String, List<Facet>> getOuts() { |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
89 return outs; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
90 } |
1271
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
91 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
92 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
93 @Override |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
94 public int hashCode() { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
95 if (getOuts() != null) { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
96 return getOuts().hashCode(); |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
97 } |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
98 return 0; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
99 } |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
100 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
101 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
102 @Override |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
103 public boolean equals(Object other) { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
104 if (!(other instanceof Filter) || other == null) { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
105 return false; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
106 } |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
107 Filter filter = (Filter) other; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
108 return Recommendation.same(filter.getOuts(), this.getOuts()); |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
109 } |
845
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
110 } // class Filter |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
111 |
1442
4a6814be92ba
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
112 /** Factory to speak to when creating/cloning. */ |
839
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
113 protected String factory; |
1442
4a6814be92ba
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
114 /** Sometimes database ids, sometimes other freeform text. */ |
839
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
115 protected String ids; |
1543
0b79630e3bcb
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1442
diff
changeset
|
116 /** Artifacts uuid that should serve as master artifact. */ |
844
ac70261bb3f8
Allow passing no master artifact to RPC service when creating new artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
839
diff
changeset
|
117 protected String masterArtifact; |
1442
4a6814be92ba
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
118 /** Optional facet filter. */ |
845
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
119 protected Filter filter; |
1352
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
120 protected String displayName = null; |
839
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
121 |
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
122 public Recommendation() { |
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
123 } |
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
124 |
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
125 public Recommendation(String factory, String ids) { |
845
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
126 this(factory, ids, null, null); |
839
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
127 } |
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
128 |
845
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
129 public Recommendation( |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
130 String factory, |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
131 String ids, |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
132 String masterArtifact, |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
133 Filter filter |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
134 ) { |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
135 this.factory = factory; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
136 this.ids = ids; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
137 this.masterArtifact = masterArtifact; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
138 this.filter = filter; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
139 } |
839
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
140 |
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
141 public String getFactory() { |
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
142 return factory; |
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
143 } |
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
144 |
1349
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1271
diff
changeset
|
145 public void setFactory(String factory) { |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1271
diff
changeset
|
146 this.factory = factory; |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1271
diff
changeset
|
147 } |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1271
diff
changeset
|
148 |
1352
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
149 public void setDisplayName(String displayName) { |
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
150 this.displayName = displayName; |
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
151 } |
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
152 |
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
153 public String getDisplayName() { |
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
154 return this.displayName; |
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
155 } |
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
156 |
839
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
157 public String getIDs() { |
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
158 return ids; |
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
159 } |
844
ac70261bb3f8
Allow passing no master artifact to RPC service when creating new artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
839
diff
changeset
|
160 |
ac70261bb3f8
Allow passing no master artifact to RPC service when creating new artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
839
diff
changeset
|
161 public String getMasterArtifact() { |
ac70261bb3f8
Allow passing no master artifact to RPC service when creating new artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
839
diff
changeset
|
162 return masterArtifact; |
ac70261bb3f8
Allow passing no master artifact to RPC service when creating new artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
839
diff
changeset
|
163 } |
ac70261bb3f8
Allow passing no master artifact to RPC service when creating new artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
839
diff
changeset
|
164 |
ac70261bb3f8
Allow passing no master artifact to RPC service when creating new artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
839
diff
changeset
|
165 public void setMasterArtifact(String masterArtifact) { |
ac70261bb3f8
Allow passing no master artifact to RPC service when creating new artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
839
diff
changeset
|
166 this.masterArtifact = masterArtifact; |
ac70261bb3f8
Allow passing no master artifact to RPC service when creating new artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
839
diff
changeset
|
167 } |
845
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
168 |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
169 public Filter getFilter() { |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
170 return filter; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
171 } |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
172 |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
173 public void setFilter(Filter filter) { |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
174 this.filter = filter; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
175 } |
1271
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
176 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
177 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
178 @Override |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
179 public int hashCode() { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
180 int hash = 0; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
181 hash += (getFactory() != null) |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
182 ? getFactory().hashCode() |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
183 : 0; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
184 hash += (getIDs() != null) |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
185 ? getIDs().hashCode() |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
186 : 0; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
187 hash += (getFilter() != null) |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
188 ? getFilter().hashCode() |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
189 : 0; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
190 hash += (getMasterArtifact() != null) |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
191 ? getMasterArtifact().hashCode() |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
192 : 0; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
193 return hash; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
194 } |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
195 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
196 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
197 /** |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
198 * Null-pointer guarded equals. |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
199 * Two null's are assumed equal (returns true); |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
200 * @param a Object to compare against parameter b. |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
201 * @param b Object to compare against parameter a. |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
202 * @return true if either a and b are null or a.equals(b) returns true. |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
203 */ |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
204 protected static boolean same(Object a, Object b) { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
205 // Do null-check. |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
206 if (a == null) { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
207 return b == null; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
208 } else if (b == null) { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
209 return false; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
210 } |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
211 return a.equals(b); |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
212 } |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
213 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
214 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
215 @Override |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
216 public boolean equals(Object other) { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
217 if (!(other instanceof Recommendation) || other == null) { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
218 return false; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
219 } |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
220 Recommendation rec = (Recommendation) other; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
221 return (same(this.getFactory(), rec.getFactory())) |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
222 && (same(this.getIDs(), rec.getIDs())) |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
223 && (same(this.getFilter(), rec.getFilter())) |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
224 && (same(this.getMasterArtifact(), rec.getMasterArtifact())); |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
225 } |
807
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
226 } |
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
227 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |